[R] Repeat dataframe

Kenneth Cabrera krcabrer at epm.net.co
Mon May 1 18:46:12 CEST 2006


Well, I find a solution!

If DFe is a data frame and n is an integer then

DFr<-data.frame(t(matrix(rep(t(DFe),n),dim(DFe)[2],dim(DFe)[1]*n)))
names(DFr)<-names(DFe)

Will work!!

Maybe somebody has a more elegant solution.

Again, thank you for your help.



On Mon, 01 May 2006 11:23:14 -0500, Kenneth Cabrera <krcabrer at epm.net.co>  
wrote:

> Hi R list:
>
> How can I "repeat" a data frame n times (with n>1000),
> and obtain a new data frame where all the n data frames
> are binded by rows?
>
> Thank you for your help
>
> Kenneth
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/




More information about the R-help mailing list