[R] creating categorical frequency tables from continuous data
lm609 at york.ac.uk
Thu Jan 27 15:58:56 CET 2011
I am working with a dataset which essentially has only one column - a
list of distances in metres, accurate to several decimal places. eg
I want to organise this into a frequency table, grouping into categories
of 0 - 999, 1000 - 1999, 2000-2999 etc. I'd also like the rows where
there are no data points in that category to contain 0, in order to be
able to plot a histrogram with a linear x axis, and to statistically
analyse differences between datasets.
I have tried table() which doesn't group the data the way I'd like it,
I've also tried cut() but couldn't make it work. Ideally I'd like the
output to look something like this...
Any suggestions that are an improvement on doing it manually please?
Thanks in advance!
More information about the R-help