What about:  

>  matrix(rep(foo,2),ncol=length(foo),byrow=TRUE)



-----Original Message-----
From: David Andel [mailto:andel@ifi.unizh.ch]
Sent: 08 July 2003 14:58
To: r-help@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@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


KSS Ltd
Seventh Floor  St James's Buildings  79 Oxford Street  Manchester  M1 6SS  England
Company Registration Number 2800886
Tel: +44 (0) 161 228 0040	Fax: +44 (0) 161 236 6305
mailto:kssg@kssg.com		http://www.kssg.com


The information in this Internet email is confidential and m...{{dropped}}


