Try this: sapply(theList, '[[', 'A')
On Wed, Sep 16, 2009 at 8:34 AM, Rainer M Krug <r.m.k...@gmail.com> wrote: > Hi > > I have a list which cosists out of dataframes of the same structure. Now I > want to extract one column (let's say column "A") from all dataframes and > have them in a matrix (or dataframe). > > At the moment I am doiong: > > d <- data.frame(A=runif(100), B=rnorm(100)) > theList <- list(e1=d, e2=d, e3=d, e4=d) > f <- sapply(theList, function(l){l$A} ) > > But I am sure ther is a more elegant way? > > Rainer > > -- > Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch > University, South Africa > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ 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.