search for: createsubset

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

Did you mean: createsubsets
2007 Apr 20
2
Fastest way to repeatedly subset a data frame?
...end up with vectors that contain just the results for the IDs found in each vector in the list. My current approach is to create new columns in the original data frame with the names of the list items, and any results that don't match replaced with NA. Here is what I've done so far: createSubsets <- function(res, slib) { for(i in 1:length(slib)) { res[ ,names(slib)[i]] <- replace(res$result, which(!is.element(res$sid, slib[[i]])), NA) return (res) } } I have 2 problems: 1) My function only works for the first item in the list: > my.df <- createSubs...