Hi Jason, Something along the lines of
with(Orange, table(cut(age, breaks = c(118, 664, 1004, 1372, 1582, Inf)), cut(circumference, breaks = c(30, 58, 62, 115, 145, 179, 214)))) should get you started. HTH, Jorge On Sat, Mar 5, 2011 at 5:38 PM, Jason Rupert <> wrote: > Working with the built in R data set Orange, e.g. with(Orange, table(age, > circumference)). > > > How should I go about about grouping the ages and circumferences in the > following ranges and having them display as such in a table? > age range: > 118 - 664 > 1004 - 1372 > 1582 > > circumference range: > 30-58 > 62- 115 > 120-142 > 145-177 > 179-214 > > Thanks for any feedback and insights, as I hoping for an output that looks > something like the following: > circumference range > 30-58 62- 115 145-177.... > age range > 118 - 664 ... > 1004 - 1372 ... > 1582 .... > > > Thanks a ton. > > ______________________________________________ > 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.