[R] renaming factor-labels / add factors etc.

Jörg Groß joerg at licht-malerei.de
Tue Dec 16 03:26:23 CET 2008


how can I change a defined factor-variable?
Like adding levels, renaming existing levels or merge several levels  
of a factor to one level?

For example; following factor-variable is given:

  x <- factor(c("xyz1", "abc1", "xyz2", "abc2"))

How can I add the level fgh?
And how can I merge "xyz1" and "xyz2" to one level?
And how can I change the name?

Thanks for any help!

More information about the R-help mailing list