[R] What is the correct way to merge factors?

Svetlana Eden svetlana.eden at vanderbilt.edu
Thu Feb 5 20:51:27 CET 2004


I have two factors l1, l2, and I'd like to merge them.
Function c() does not give me the result I want:

> l1 = factor(c('a', 'b'))
> l2 = factor(c('c', 'd'))
> lMerge = c(l1, l2)
> lMerge
[1] 1 2 1 2
>

I'd like to merge l1 and l2 and to get lMerge 
----------------------------------------------

[1] a b c d
Levels: a b c d

instead of 
----------

[1] 1 2 1 2
>

How should I do that?
---------------------

-- 
Svetlana Eden        Biostatistician II            School of Medicine
                     Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list