search for: iexclude

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

Did you mean: exclude
2007 Apr 25
1
regular expressions with grep() and negative indexing
...e vector contains no elements with that word. For instance, if I have x2 <- c("dolphin.0","dolphin.1") then x2[-grep("exclude",x2)] will give me 'character(0)' I know I can accomplish this in several steps, for instance: myfunc <- function(x) { iexclude <- grep("exclude",x) if(length(iexclude) > 0) x2 <- x[-iexclude] else x2 <- x # do stuff with x2 <...? } But this is embedded in a much larger function and I am trying to minimize intermediate variable assignment (perhaps a futile effort). But if anyone knows of...