How could I create a histogram from this set of summarized data in R?
I attempted this:
dataset <- c(4,17,12,6)
hist(dataset)
However, this showed me the data without the "0-19","60-99" breaks etc.
I would like to know how to create this histogram with the correct breaks and names. Thanks.
You need a barplot.
Height = c(4,17,12,6)
Bins = c("0-19", "20-39", "40-59", "60-99")
barplot(Height, names.arg=Bins)
barplot
has many parameters that you might consider adjusting to make this prettier.