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,
Is the following sort of what you want?
y = factor(c(ff,f,m,mm,fm,mf,ffm,mmf,mmm,fff))
levels(y) - substring(levels(y), 1, 1)
y
[1] f f m m f m f m m f
Levels: f m
Andy
From: Oleg Bartunov
Hello,
is't possible to specify pattern in levels ?
y=c(ff,f,m,mm,fm,mf,ffm,mmf,mmm,fff);
On Thu, 25 Mar 2004, Liaw, Andy wrote:
Is the following sort of what you want?
thanks for example, but I need something more :)
In real situation, I'd like to use perl like patterns (like in grep),
or just implicitly specify levels, for example: level F is (f.*, mmm)
y =