[R] list of data.frames?

David Winsemius dwinsemius at comcast.net
Wed Jun 17 20:52:55 CEST 2009


On Jun 17, 2009, at 2:45 PM, Dimitris Rizopoulos wrote:

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

Or:

lis[["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
>
> ______________________________________________
> 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
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list