Hi All,
Suppose I have the following codes:
x = data.frame(A = rnorm(20), B = rnorm(20), C = rnorm(20))
a = list()
a[["1.1"]] = x
a[["1.2"]] = x
b = list()
b[["1.1"]] = c("A", "B")
b[["1.2"]] = c("B", "C")
Now I want to apply b to a like this, for each element of 'a', only select the
corresponding columns listed in 'b'. For example, after that operation,
a[["1,1"]] become subset(a[["1.1"]], select = c("A", "B"))
a[["1,2"]] become subset(a[["1.1"]], select = c("B", "C"))
Do you know how to do it without looping?
Thanks.
HXD
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.