frequency distribution in R (creating adequate class boundaries)

#1
Hello,

I had a quick question about creating a frequency distribution in R.
I am very new to R and statistics in general, so please forgive me if my post for this thread here seems unclear.

I am having problems creating a frequency distribution with adequate class boundaries in R.

I started out by trying to create a table of frequencies for my data set (bluman020202), and I did the following, obtaining the following output:
Code:
> table(bluman020202)
bluman020202
100 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 127 134
  1   1   3   1   1   1   2   5   2   4   2   5   1   2   3   6   1   4   1   2   1   1
The output seemed to be correct.

I then tried to create my class boundaries by doing the following:
Code:
bins = seq(99.5,134.5,by=5)
The output I received was:
Code:
> bins
[1]  99.5 104.5 109.5 114.5 119.5 124.5 129.5 134.5
Again, all seemed to be correct so far.

Then, I tried:
Code:
> classboundaries020202 = cut(bluman020202$TEMPERATURES, bins)
> table(classboundaries020202)
classboundaries020202
(99.5,104]  (104,110]  (110,114]  (114,120]  (120,124]  (124,130]  (130,134]
         2          8         18         13          7          1          1
This is not the output I was trying to achieve, and so this is where I am stuck. The output I had wanted to receive would have included
(99.5,104.5] (104.5,109.5] (109.5,114.5] (114.5,119.5] (119.5,124.5] (124.5,129.5] (129.5,134.5] as the class boundaries.

I am not at all sure how to create the frequency distribution with the correct class boundaries, and so it is this that I would like help with, if at all possible.

Thanks in advance for any help you maybe able to provide, and apologies again if my post was unclear...
If there is any additional information I can provide with regards to my question, please let me know.
 

Dason

Ambassador to the humans
#2
Try looking at what end up in each bin. I'm guessing your boundaries were respected but the names given to the groups were rounded to only use three digits.
 
#3
Thank you for your assistance. I was able to achieve that which I was looking to accomplish by doing the following:

Code:
> classboundaries020202new = cut(bluman020202$TEMPERATURES, breaks=c(99.5, 104.5,109.5,114.5,119.5,124.5,129.5,134.5), labels=c('(99.5,104.5]','(104.5,109.5]', '(109.5,114.5]', '(114.5,119.5]', '(119.5,124.5]', '(124.5,129.5]', '(129.5,134.5]'))
Code:
> table(classboundaries020202new)
classboundaries020202new
 (99.5,104.5] (104.5,109.5] (109.5,114.5] (114.5,119.5] (119.5,124.5] (124.5,129.5] (129.5,134.5]
            2             8            18            13             7             1             1
Thanks again.