Skip to content
Prev 205895 / 398506 Next

data frame names in sequence. please help!!!

On Sun, Jan 10, 2010 at 7:16 AM, Berend Hasselman <bhh at xs4all.nl> wrote:
Or better still, have a look at making a *list* instead of a bunch of
data frames with numbers in their names, then you can index in a
sensible way without having to construct names with paste and get.
Here's a list of data frames:

 L = list()
 for(i in 1 :10){
  L[[i]]=data.frame(x=runif(10))
}

 Now you can loop over L[[i]]

 This has been asked a zillion times on R-help. Sure, if you've
already mistakenly created 200 data frames then you need the paste/get
solution, but don't make the same mistake twice. Use a list.

Barry