Hi Tammy, Check ?cut and its examples.
HTH, Jorge.- On Wed, Dec 5, 2012 at 11:26 PM, Tammy Ma <> wrote: > > HI, All > > I met the following problem. I dont know how to handle it. > > Country Price > 1 CN 44.25 > 2 CN 21.07 > 3 CN 92.70 > 4 CN 47.41 > 5 CN 111.67 > 6 CN 50.57 > > > I want to create the 3rd colume with different factor levels: > [1] "0-30" "51-75" "31-50" "76-100" "101-150" "151-200" "201-300" > "500+" > [9] "301-400" "401-500" > > then the final result which I want is: > > Country Price levels > 1 CN 44.25 "31-50" > 2 CN 21.07 "0-30" > 3 CN 92.70 "76-100" > 4 CN 47.41 "31-50" > 5 CN 111.67 "101-150" > 6 CN 50.57 "51-75" > > > How can I do this? > > Thanks. > > Tammy > > > > [[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. > [[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.