[R] factor based on pattern match ?
    Oleg Bartunov 
    oleg at sai.msu.su
       
    Thu Mar 25 23:02:13 CET 2004
    
    
  
Hello,
is't possible to specify pattern in levels ?
> y=c("ff","f","m","mm","fm","mf","ffm","mmf","mmm","fff");
> factor(y)
 [1] ff  f   m   mm  fm  mf  ffm mmf mmm fff
Levels: f ff fff ffm fm m mf mm mmf mmm
I want to specify levels using regexp ("f.*","m.*") or use some
another method. So, I could have 2 levels, say, F and M, where
F means everything  beginning from 'f' and M - from 'm'.
Something like cut() for numerical data.
	Regards,
		Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg at sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
    
    
More information about the R-help
mailing list