Hi all,

I have an object that looks (roughly) like the following:

l <- list(a = matrix(rnorm(9), 3), b = matrix(rnorm(9), 3), c =
matrix(rnorm(9), 3))

l$a[3,] <- sample(c("Message 1", "Message 2", "Message 3"))
l$b[3,] <- sample(c("Message 1", "Message 2", "Message 3"))
l$c[3,] <- sample(c("Message 1", "Message 2", "Message 3"))

rownames(l$a) <- rownames(c(1:3), do.NULL = FALSE, prefix = "row")
rownames(l$b) <- rownames(c(1:3), do.NULL = FALSE, prefix = "row")
rownames(l$c) <- rownames(c(1:3), do.NULL = FALSE, prefix = "row")

colnames(l$a) <- c("V1", "V2", "V3")
colnames(l$b) <- c("V1", "V2", "V3")
colnames(l$c) <- c("V1", "V2", "V3")

I want to extract values (row1, V1) for the three sublists a, b, c,
but only for those cases in which row3 == "Message 1". Could someone
suggest how to proceed?

Many thanks in advance,
Lara

______________________________________________
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