I am a bit new to R and I was experimenting with ggplot.
I have a table like this:
table http://dl.dropbox.com/u/43697/temporary/data_frame.jpg
I would like to modify the table to set bins based on different breaks and record the frequency for each bin:
table http://dl.dropbox.com/u/43697/temporary/data_frame2.jpg
I guess the first thing to do would be to set breaks on the year columns and later transpose them to match the AllotmentID.
Any thoughts?
Without a reproducible example, and no hint of what sort of graph you’d like to make using
ggplot2, all I can do is point you in the direction of a useful tool. In this case I suspect you will want to make good use of the functioncut, which is usually the go-to tool in R for binning.cutwill return a factor, which you will likely want to pass totableto count the number of observations in each “bin”.EDIT
Here’s a very bare bones example. You will want to tinker with it to make the breaks and bins work out the way you want them to: