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.

Reply via email to