[R] Subset with selection variable from function argument. Is there another way?
Fredrik Karlsson
dargosch at gmail.com
Wed May 11 11:01:00 CEST 2005
Dear list,
I'm making my current code more generic and would like some advise.
The basic problem is subset and the name of the column to be compared
for selection.
What I've come up with is
> data(mammals)
> set <- bottompremolars"
> subset(mammals, eval(parse(file="",text=set)) > 2)
This seems a bit odd. Is there a nicer way?
/Fredrik
More information about the R-help
mailing list