[R] concatenating factor from list
Sebastian Luque
spluque at gmail.com
Thu Mar 16 01:32:39 CET 2006
Sebastian Luque <spluque at gmail.com> wrote:
"Gabor Grothendieck" <ggrothendieck at gmail.com> wrote:
>> Is this ok or is it what you are trying to avoid:
>> factor(unlist(lapply(cutYield, as.character)))
> Thank you Gabor. The problem with that is what if some levels do not
> appear in any member of cutYield?
This addition to your code takes care of that, although it's a bit
expensive:
factor(unlist(lapply(cutYield, as.character)),
levels = unique(unlist(lapply(test, levels))))
Thanks!
--
Sebastian P. Luque
More information about the R-help
mailing list