I want to create a histogram plot with ggplot starting from a frequency table. The freuqency table is the following:
Income | Frequency |
---|---|
0-10 | 60 |
10-30 | 50 |
30-60 | 40 |
60-100 | 10 |
I create:
a data.frame of the data
es1_=data.frame(income=c(0,10,30,60,100),VALUE=c(0,60,50,40,10),DENSITY=c(0,60/10,50/20,40/30,10/40))
the break vector
intervalli=c(0,10,30,60,100)
a histogram
es1_ %>% ggplot()+ geom_histogram(aes(x=INCOME,weight=DENSITY),breaks=intervalli)
Is it possible obtain the same histogram without edit manualy the DENSITY data? How can obtain the same plot with the geom_histogram standard option? Thank you in advance.