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.

Reply via email to