[R] Unique Data Frame Name?

Douglas M. Hultstrand dmhultst at metstat.com
Thu Jun 24 00:56:43 CEST 2010


Hello,

I am trying to create a data frame with a unique name, based on indexing 
of for loop.  I was wondering if there is a way to do this, I keep 
running into errors when I try to do this.  Below is a brief example, I 
am trying to get two data frames (name1 and name2).

Any suggestions are appreciated.

Thanks,
Doug

# Example
for (i in 1:2) {
        x=c(1,2,3,4)
        y=c(10,20,30,40)
        G <- paste("name", i, sep="")
        G[i] <- data.frame(x,y)
}

-- 
---------------------------------
Douglas M. Hultstrand, MS
Senior Hydrometeorologist
Metstat, Inc. Windsor, Colorado
voice: 720.771.5840
email: dmhultst at metstat.com
web: http://www.metstat.com



More information about the R-help mailing list