I have vector containing numbers (18 20 21 22 24 26 27 34 35 35)
Now I need to build table with
- frequency distribution
- relative frequency distribution
by predefined bins (16-20, 21-25, 26-30, 31-35)
And plot histogram according to these bins
I have vector containing numbers (18 20 21 22 24 26 27 34 35 35)
Now I need to build table with
by predefined bins (16-20, 21-25, 26-30, 31-35)
And plot histogram according to these bins
You can use hist
with specified breaks
. For example:
numbers = c(18, 20, 21, 22, 24, 26, 27, 34, 35, 35)
hist(numbers, breaks = seq(15, 35, length.out = 5))