[R] rbind question

Patrick Burns pburns at pburns.seanet.com
Tue Jul 8 16:14:34 CEST 2003


do.call("rbind", rep(list(foo), n))

Patrick Burns

Burns Statistics
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

David Andel wrote:

>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
>
>
>  
>




More information about the R-help mailing list