[R] repeating a dataframe n times in the direction of the rows
Wolfram Fischer
wolfram at fischer-zim.ch
Mon Nov 11 11:32:08 CET 2002
Question:
How can a repeat a dataframe n times
in the direction of the rows?
(Or: How I can rbind a dataframe n times ?)
Example Data:
x <- data.frame( alpha=letters[1:3], num=1:3 )
n <- 4
Complicated solution: To rbind a dataframe n times I can program a loop:
xr <- x
for( i in 2:n ) xr <- rbind( xr, n )
Observation: To cbind a dataframe n times I can use rep:
xc <- data.frame( rep( x, n ) )
Is there a similar possibility to repeat in the direction of the rows?
Wolfram
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list