[R] Creating data frames in a loop
David Winsemius
dwinsemius at comcast.net
Wed May 12 06:22:14 CEST 2010
On May 11, 2010, at 11:01 PM, Nish wrote:
>
> Hello,
>
> I am new to R and have a question on creating data frames at run
> time in a
> loop. How can I create it? For example, something like the following
> which
> will create 20 dataframes.
Well not unless you
>
> for(i in 1:20) {
> ddat_<current value of i> <- data
> other processing...
> }
>
ddat <- as.list(rep("", 20))
for(i in 1:20) {
ddat[[i]] <- data.frame(ivec = 1:i)
#other processing..
}
--
David.
> Thanks.
> --
> View this message in context: http://r.789695.n4.nabble.com/Creating-data-frames-in-a-loop-tp2195527p2195527.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list