search for: getinfcodesubset

Displaying 1 result from an estimated 1 matches for "getinfcodesubset".

2008 Oct 31
1
subset with variable number of subset arguments
...ore than 5 codes. Now my needs have increased faster than my R skills did and I need to call my function with about 25 values for x. There has to be a *apply or even simpler solution which (after RTM) I'm not able to figure out. Can anybody direct me to a possible solution? Regards, Brar GetInfCodeSubset <- function(set, x){ if(1 == length(x)) return(subset(set, (set$InfCode == x[1]))) else if(2 == length(x)) return(subset(set, (set$InfCode == x[1]) | (set$InfCode == x[2]))) else if(3 == length(x)) return(subset(set, (set$InfCode == x[1]) | (set$InfCode == x[2]) | (set$InfCode == x[3]))...