Message-ID: <4284E06D.8060009@stat.wisc.edu>
Date: 2005-05-13T17:14:21Z
From: Douglas Bates
Subject: List and Column Names in a Function?
In-Reply-To: <OFEAFA8582.BCD6EBE9-ON86257000.005D4F32-86257000.005D6415@fd9ns01.okladot.state.ok.us>
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?