Hi Will, One way would be:
> x [1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 > factor(ifelse(x>6 & x<18, 'day', 'night')) [1] night night night night night night night day day day day day day day day [16] day day day night night night night night night night Levels: day night HTH, Jorge On Fri, Oct 29, 2010 at 8:56 PM, will phillips <> wrote: > > Hello > > I have what is probably a very simple grouping question however, given my > limited exposure to R, I have not found a solution yet despite my research > efforts and wild attempts at what I thought "might" produce some sort of > result. > > I have a very simple list of integers that range between 1 and 24. These > correspond to hours of the day. > > I am trying to create a grouping of Day and Night with > Day = 6 to 17.99 > Night = 1 to 5.59 and 18 to 24 > > Using the Cut command I can create the segments but I have not found a > "combine" type of command to merger the two "night" segments. No luck with > if/else either. > > Any help would be greatly appreciated > > Thank you > > Will > > > -- > View this message in context: > http://r.789695.n4.nabble.com/grouping-question-tp3019922p3019922.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.