[R] how to use AND in grepl

John McKown john.archie.mckown at gmail.com
Mon May 2 20:10:59 CEST 2016


On Mon, May 2, 2016 at 1:01 PM, ch.elahe via R-help <r-help at r-project.org>
wrote:

> I just changed all the names in Command to lowercase, then this
> str_extract works fine for "pd" and "t2", but not for "PDT2". Do you have
> any idea how I can bring PDT2  also in str_extract?
>

Looking at ​?grepl, I see the option: ignore.case=TRUE​

 PDT2=subset(df,grepl("(.*t2.*pd.*)|(.*pd.*t2.*)",df$
Command,ignore.case=TRUE)

Perhaps this will do the trick.

-- 
The unfacts, did we have them, are too imprecisely few to warrant our
certitude.

Maranatha! <><
John McKown

	[[alternative HTML version deleted]]



More information about the R-help mailing list