Mittwoch, 12. November 2008

R trick - transform numerical levels to their 'real' value

from help documentation of 'factors'

To transform a factor f to its original numeric values, as.numeric(levels(f))[f] is recommended and slightly more efficient than as.numeric(as.character(f)).