-
-
Save jonathanlxy/d19d840b79282efa0b3d7f097a427751 to your computer and use it in GitHub Desktop.
Vision Zero Visualization Blog Post Gist
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
#### Load Data Set #### | |
# You need to download this data by yourself. | |
# See https://data.cityofnewyork.us/Public-Safety/NYPD-Motor-Vehicle-Collisions/h9gi-nx95 | |
collision <- fread('NYPD_Motor_Vehicle_Collisions.csv', stringsAsFactors = F) | |
# Transform Date & Time (rounded to hour) | |
work_dt <- collision %>% | |
mutate(FULLDATE = as.POSIXct(paste(DATE, TIME), | |
format = '%m/%d/%Y %H:%M', | |
tz = 'EST') | |
) %>% | |
mutate(YEAR = year(FULLDATE), | |
MONTH = month(FULLDATE), | |
DAY = mday(FULLDATE), | |
HOUR = hour(round(FULLDATE, 'hour')) | |
) %>% | |
as.data.table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment