Skip to content
Prev 174404 / 398506 Next

Subsetting data where the condition is that the value of some column contains some substring

grep and regexpr return different values.  regexpr returns a vector of
the same length as the input and this can be used to construct a
logical subscript.  grep return a vector of only the matches, in which
case you can have a length of zero if there are no matches.  Makes it
harder to create the subsets.  You have to test for zero length and
then do something special.
On Fri, Mar 20, 2009 at 9:20 PM, Max Bane <max.bane at gmail.com> wrote: