You can do: factor(c(as.character(l1), as.character(l2)))
HTH, Andy > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Svetlana Eden > Sent: Thursday, February 05, 2004 2:51 PM > To: [EMAIL PROTECTED] > Subject: Re: [R] What is the correct way to merge factors? > > > 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 > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > ------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}} ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html