[R] list of data.frames?

Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl
Wed Jun 17 20:45:48 CEST 2009


try this:

dat1 <- data.frame(x = rnorm(5))
dat2 <- data.frame(y = rnorm(5))
dat3 <- data.frame(z = rnorm(5))

lis <- list(dat1 = dat1, dat2 = dat3)
c(lis, list(dat3 = dat3))


I hope it helps.

Best,
Dimitris


Steve Jaffe wrote:
> I'm trying to build up a list of data.frames by "appending" one by one. 
> 
> If x,y,z are data.frames, I can do
> 
> somelist <- list(x, y, z)  (or even somelist <- list(x=x, y=y, z=z) to get
> names)
> 
> But if I start with 
> 
> somelist <- list(x,y) and now want to go from this to list(x,y,z) I'm stuck.
> I've tried
> 
> append(somelist, z)
> c(somelist, z)
> list(somelist, z)
> 
> Each gives a different result but none are what I'm looking for. Any
> suggestions? Thanks
> 

-- 
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014




More information about the R-help mailing list