Skip to content
Prev 360564 / 398503 Next

how to use AND in grepl

Tom
Actually not sure my previous answer does what you wanted. Using your
approach:

 t2pd=subset(df,grepl("t2",df$Command) & grepl("pd",df$Command))

Should work.

I think the regex pattern you are looking for is:

 Subset(df,grepl("(.* t2.*pd.* )|(.* pd.* t2.*)",df$Command)
On Sat, Apr 30, 2016, 7:07 PM Tom Wright <tom at maladmin.com> wrote: