0

So I have a dataframe that looks like this.

name value
<int> <fct>
1    1
2    2.5
3    8
4    6
5    8
6    25
7    28
8    3
9    12
10   1.5
11   0.5
12   8
13   0.8
14   1.8
15   12
16   0.00594
17   1.2
18   3
19   1.25
20   5
21   300
22   38

I want to group these numbers so when I plot my histogram it goes 0,1,2,3,....,40,40+ on the x-axis and the 'count' is shown on the y-axis. So for example, there should be 3 between 0 and 1. I'd like to use ggplot2 and geom_histogram() if possible.

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Can you show the expected output – akrun Jan 25 '21 at 18:20
  • What you are describing isn't a histogram any more. A histogram is a way to estimate the underlying probability density of a continuous random variable such that the area under the curve sums to 1. You're better off trying to make a bar plot of counts. – MrFlick Jan 25 '21 at 18:30

0 Answers0