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
--
http://had.co.nz/
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel