Re: [R] Repeat dataframe

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 02 May 2006 - 02:52:44 EST

On Mon, 1 May 2006, Kenneth Cabrera 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?

Perhaps

my_df[rep(1:nrow(my_df), times=n), ]

is what you want?

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue May 02 03:01:24 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 02 May 2006 - 04:10:01 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.