Dear all,
Trying to extract a few rows for each element of a list of data.frames, I'm puzzled by the following behaviour,
d <- lapply(1:4, function(i) data.frame(x=rnorm(5), y=rnorm(5))) str(d) lapply(d, "[", i= c(1)) # fine, this extracts the first columns lapply(d, "[", j= c(1, 3)) # doesn't do nothing ?! library(plyr) llply(d, "[", j= c(1, 3)) # same
Am i misinterpreting the meaning of "j", which I thought was an argument of the method "[.data.frame"?
args(`[.data.frame`) function (x, i, j, drop = if (missing(i)) TRUE else length(cols) == 1)
Many thanks, baptiste _____________________________ Baptiste AuguiƩ School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag ______________________________________________ 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.