There seams to be something wrong with my histogram.
I would really appreciate some help with this puzzle!!
I am trying to plot the hours crime was reported in the crime data set by year. However, the data for the 'hours of the day crime was reported' (x axis) does not start at zero? It is slightly offset. I don't know why and am trying to reproduce a graph in which the data stats at zero (see bellow).
Also, in the original graph the max crimes reported per hour is >20000, while on my graph reports only go up to 1500. Again I am lost as to why?
all advice would be greatly appreciated!!
Here is the code: warning it may take a few minutes to get the data set
heres my graph if you can figure it out from this:)
library(tidyverse) library(lubridate) library(dslabs) library(crimedata) crime <- crimedata::get_crime_data(years = 2008:2018) write.csv(crime, file = './data/crime.csv') crime <- crime20 # renaming for clarity - it is not the whole data set # Exploring hourly reporting crime20_hour <- crime20 %>% mutate(hour = hour(date_single)) ## shift axis????? ggplot(crime20_hour, aes(x = hour, stat = "identity"))+ geom_histogram(binwidth=1, fill="grey")