I have a set of transaction values whose range are 0-15000 USD. I've plotted a histogram specifying breaks of $250 bin values, which is helpful. What I would like to do is go back into the dataframe and create my own bin values within the data frame. The bins would specify the range that the transactions fall into, such as: 0-250, 251-499, 500-749, 750...by 250 all the way up to 15,000.
I looked at this nifty post Generate bins from a data frame regarding 'cut' and 'findInterval' but they aren't really meeting my expectations. It's either nasty factors that looks okay for low bin ranges but once I get above $x,000 I get e-values (1.27e+04, 1.3e04).
What I'd like is:
Tran ID Amount Bin
135 $249.22 0-250
138 $1,022.01 1000-1249
155 $10,350.11 10,249-10,500
Is this possible with 'cut'
or 'findInterval'
or is there a better implementation?