Skip to content
Prev 167413 / 398503 Next

regex -> negate a word

Roland,

I think you were almost there with your first example.  Howabout using:

 > x <- c("abcdef", "defabc", "qwerty")
 > y <- grep(pattern="abc", x=x)
 > z.char <- x[-y]
 > z.index <- (1:length(x))[-y]
 >
 > z.char
[1] "qwerty"
 > z.index
[1] 3

Cheers,
eric
Rau, Roland wrote: