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

______________________________________________
R-help@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.

Reply via email to