[R] Re: Re: List and Column Names in a Function?

Douglas Bates bates at stat.wisc.edu
Fri May 13 19:14:21 CEST 2005


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?




More information about the R-help mailing list