1

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

1 Answers1

0

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))

enter image description here

Abdur Rohman
  • 2,691
  • 2
  • 7
  • 12