[R] assign color to subsets

chalabi.elahe at yahoo.de chalabi.elahe at yahoo.de
Sat Apr 23 22:16:50 CEST 2016

I have the following df and I created two subsets but I don't know how to use these subsets as the colors of my plot.

   data.frame': 36919 obs. of 162 variables 
   $TE           :int 38,41,11,52,48,75,..... 
   $TR           :int 100,210,548,546,..... 
   $Command       :factor W/2229 levels "_localize_PD","_localize_tre_t2","_abdomen_t1_seq","knee_pd_t1_localize"...

and the subsets are names in Command which has t1 or t2 letters:

  hast1=grepl("t1", df$Command, fixed=TRUE) 
  hast2=grepl("t2", df$Command, fixed=TRUE) 

the colors I want in my plot are : hast1 and hast2 
Thanks for any help.

More information about the R-help mailing list