Created
October 24, 2016 05:46
-
-
Save yeere91/380563a838521a88e9f846aa412b05d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############### By Time | |
# We want to organize the crashes by hours | |
date_hour = strptime(vehc$TIME,"%H") | |
hour = as.numeric(format(date_hour, "%H")) + | |
as.numeric(format(date_hour, "%M"))/60 | |
vehc$hour = hour | |
common_times = vehc %>% group_by(hour) %>% | |
summarize(count=n()) %>% | |
arrange(desc(count)) | |
##Barchart of the common times of car crashes in the entire dataset. | |
g_hour=ggplot(data=common_times) | |
g_hour+geom_bar(aes(x=hour, y=count),stat="identity") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment