[R] subset by multiple letters condition

chalabi.elahe at yahoo.de chalabi.elahe at yahoo.de
Fri Apr 22 15:42:29 CEST 2016

Hi all, 

I have a data frame df and I want to do subset based on several conditions of letters of the names in Command.1)if the names contain PD 2)if the names contain t1 3)if the names contain t2 4)if the names contain t1 and PD 5)if the names contain t2 and PD 6)otherwise the names would be unknown. I don't know how to use grep for all these conditions. 
   'data.frame': 36919 obs. of 162 variables
   $TE                :int 38,41,11,52,48,75,.....
   $Command           :factor W/2229 levels "_localize_PD","_localize_tre_t2","_localize_t1_seq",...
Thanks for any help

More information about the R-help mailing list