[R] Any simple way to subset a vector of strings that do contain a particular substring ?

Bernhard drunken.wallaby at gmail.com
Thu Jun 19 07:56:57 CEST 2008

Hi Daren.

you could try something like:

strings[setdiff(1:length(strings), grep("ba", strings))]

?grep as well as ?regexpr will help as well!


2008/6/19 Daren Tan <daren76 at hotmail.com>:
> For example,
> strings <- c("aaaa", "bbbb","ccba").
> How to get "aaaa", "bbbb" that do not contain "ba" ?

More information about the R-help mailing list