[R] Catenating factors.
Mike.Lawrence at DAL.CA
Wed May 23 13:40:10 CEST 2007
It may be poor form, but whenever I deal with factors in this way I
find as.character and as.numeric useful
#if your factor levels are letters
#if your factor levels are numbers
On 22-May-07, at 11:56 PM, Marc Schwartz wrote:
> On Wed, 2007-05-23 at 13:38 +1200, Rolf Turner wrote:
>> I was recently asked by one of new colleagues how to combine, or
>> or concatentate two factors. If x and y are factors, doing c(x,y)
>> to coerce x and y to numeric mode before catenating them. So what
>> does one
>> do if one wants the result to be a factor whose levels are the
>> union of the
>> levels of x and y? I vaguely recall seeing this discussed in r-
>> help, but I
>> can't find anything on it there, nor in the FAQ.
>> Am I missing something obvious?
> I think that this thread from last November on R-devel may be helpful:
> Marc Schwartz
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
Graduate Student, Dalhousie University Department of Psychology
"The road to wisdom? Well, it's plain and simple to express:
Err and err and err again, but less and less and less."
- Piet Hein
More information about the R-help