Hi, May be this helps:
Data1<-read.table(text=' TYPE VALUE "Residential-future" 2.2 "Open space-managed" 1.4 "Mixed use" 5.2 "Residential-existing" 4.2 "Residential-existing" 7.1 "Residential-future" 5.2 "Residential-existing" 1.2 "mixed use" 4.5 ',sep="",header=TRUE) library(reshape) Data1[,1]<-combine_factor(Data1[,1],c(2,2,3,4,5)) levels(Data1[,1]) #[1] "Mixed use" "Open space-managed" "Residential-existing" #[4] "Residential-future" Data1[,1] #[1] Residential-future Open space-managed Mixed use #[4] Residential-existing Residential-existing Residential-future #[7] Residential-existing Mixed use #4 Levels: Mixed use Open space-managed ... Residential-future A.K. ________________________________ From: Shane Carey <careys...@gmail.com> To: arun <smartpink...@yahoo.com> Sent: Thursday, June 27, 2013 8:27 AM Subject: Re: [R] Combining levels Sorry, this is what it should be: DATA= TYPE VALUE Residential - future" 2.2 "Open space - managed" 1.4 "Mixed use" 5.2 "Residential - existing" 4.2 "Residential - existing" 7.1 "Residential - future" 5.2 "Residential - existing" 1.2 "mixed use" 4.5 Which gives me these levels= Levels: Mixed use Open space - managed Residential - existing Residential - future, mixed use I need to combine mixed use and Mixed use into one category Thank you very much. I really appreciate your help. Thanks again On Thu, Jun 27, 2013 at 1:21 PM, arun <smartpink...@yahoo.com> wrote: > >HI, >Tx for the email. Could you also show the expected result? > > > > > > >________________________________ >From: Shane Carey <careys...@gmail.com> >To: arun <smartpink...@yahoo.com> >Sent: Thursday, June 27, 2013 8:18 AM >Subject: Re: [R] Combining levels > > > > >Hi, > >DATA<-c("Residential - future" , "Open space - managed", "Mixed >use","Residential - existing", "Residential - existing", "Residential - >future","Residential - existing","mixed use") > >And I need to combine Mixed-use and mixed use > >Thank you > > > >On Thu, Jun 27, 2013 at 12:54 PM, arun <smartpink...@yahoo.com> wrote: > >Hi, >>It is difficult to test without a reproducible example. Also, it would be >>useful to know your expected output. >>I understand ?combine_factor is from library(reshape). >>A.K. >> >> >> >> >> >>----- Original Message ----- >>From: Shane Carey <careys...@gmail.com> >>To: "r-help@r-project.org" <r-help@r-project.org> >>Cc: >>Sent: Thursday, June 27, 2013 7:32 AM >>Subject: [R] Combining levels >> >>Hi, >> >>I am trying to combine two levels and leave all other levels unchnaged. I >>have tried doing the following: >> >>combine_factor(DATA$Land_zone, c("mix use","Mixed use")) >> >>but it just returns NA. >> >>Thanks >> >>-- >>Shane >> >> [[alternative HTML version deleted]] >> >>______________________________________________ >>R-help@r-project.org mailing list >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>and provide commented, minimal, self-contained, reproducible code. >> >> > > >-- >Shane > -- Shane ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.