Is the following that you are looking for? unlist(lapply(x.list, "[", 2))
HTH, Jorge.- On Mon, Mar 11, 2013 at 9:52 PM, ishi soichi <> wrote: > say I have a matrix and lists like > > x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2) > > x.list <- lapply(seq_len(nrow(x)), function(i) x[i,]) > > if I want a column of the matrix x, I write > > x[, 2] > > for example. > > But how can I do something similar for a set of lists, x.list, above? > > > x.list > [[1]] > [1] 12.1 0.1 12.0 1.1 > > [[2]] > [1] 3.44 3.00 33.10 23.00 > > unlist(x.list)[,2] does not work. > > > Anyone? > > ishida > > [[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. > [[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.