Yes, I said that Rui. If she is really just trying to extract equal length
columns from a data frame or list by names(as strings), as I said, then
none of this is necessary:
as.matrix(mtcars[, x]) ## does it
Or have I missed something?
Bert
"The trouble with having an open mind is that people
> x <- c("mtcars$disp", "mtcars$hp", "mtcars$cyl")
> x
[1] "mtcars$disp" "mtcars$hp" "mtcars$cyl"
> eval(parse(text=x))
[1] 6 6 4 6 8 6 8 4 4 6 6 8 8 8 8 8 8 4 4 4 4 8 8 8 8 4 4 4 8 6 8 4
> for (i in x) print(eval(parse(text=i)))
[1] 160.0 160.0 108.0 258.0 360.0 225.0 360.0 146.7 140.8 167.6
2 matches
Mail list logo