The argument I have in 'The R Inferno' is that how you want to combine factors may differ from someone else's desires.
There are lots of tricky questions: What about ordered factors? What if the ordered levels are different in different objects? ... Pat On 04/02/2010 15:53, Hadley Wickham wrote:
Hi all, Is there are reason that there is no c.factor method? Analogous to c.Date, I'd expect something like the following to be useful: c.factor<- function(...) { factors<- list(...) levels<- unique(unlist(lapply(factors, levels))) char<- unlist(lapply(factors, as.character)) factor(char, levels = levels) } c(factor("a"), factor("b"), factor(c("c", "b","a")), factor("d")) # [1] a b c b a d # Levels: a b c d Hadley
-- Patrick Burns pbu...@pburns.seanet.com http://www.burns-stat.com (home of 'The R Inferno' and 'A Guide for the Unwilling S User') ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel