List and Column Names in a Function?
khobson at fd9ns01.okladot.state.ok.us wrote:
The solution that Douglas proposed does not work. Any other ideas?
In what way does it not work? I get
ds <- function(myds, vec) {myds[[vec]]*2}
ds1 <- c(X=list(1:10), Y=list(11:20))
ds(ds1, "Y")
[1] 22 24 26 28 30 32 34 36 38 40 Isn't that what you wanted?