[R] group factor levels

2010-02-03 Thread baptiste auguie
Dear list, I cannot find an elegant solution to this problem. I have a factor f containing several levels (5) and I wish to create a new factor of the same length with fewer levels (2). This new factor should therefore group together some levels of the original data. Ideally this grouping would

Re: [R] group factor levels

2010-02-03 Thread baptiste auguie
As always the question seems silly after you've learned the answer! Thanks a lot, baptiste On 3 February 2010 15:06, Petr PIKAL petr.pi...@precheza.cz wrote: # order levels f.t-factor(f, levels=disorder) # change levels levels(f.t) - new.lev all.equal(f.t,f2) [1] TRUE Regards Petr