[R] rbind question

Liaw, Andy andy_liaw at merck.com
Tue Jul 8 16:07:18 CEST 2003


Using the recyling rule:

bar <- matrix(foo, nrow=n, ncol=length(foo), byrow=TRUE)

HTH,
Andy

> -----Original Message-----
> From: David Andel [mailto:andel at ifi.unizh.ch] 
> Sent: Tuesday, July 08, 2003 9:58 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] rbind question
> 
> 
> Hi
> 
> I am trying to replicate a vector in n rows for comparison 
> purposes with 
> another matrix.
> 
> foo <- c(1,2,3)
> bar <- rbind(foo,foo) # does the trick for 2 rows
> bar <- rbind(rep(foo,2)) # does something else
> 
> How do I generate a matrix with all rows=foo without writing 
> 'foo' n times as 
> arg?
> 
> Thanks,
> David
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> 

------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, ...{{dropped}}




More information about the R-help mailing list