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

From: Douglas Bates <bates_at_stat.wisc.edu>
Date: Sat 14 May 2005 - 03:14:21 EST

khobson@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?



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat May 14 03:17:59 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:45 EST