Midnight
In forming a datetime (by combining a date and a time), the package is making only a date where time is "00:00". For my current purposes, this doesn't matter (I'm just going to add 1 second to crashes at 00:00), but there appears to be a different approach in how R handles midnight datetimes (2024-5-10 00:00:00) and how STATS19 does.
Oh.. Weird. Do you have an example bit of code that generates an incorrect result?
That will help demo when it's fixed :crossed_fingers:
Hi @Robinlovelace
Here is what I mean...
`# Load packages if (!require("pacman")) install.packages("pacman") pacman::p_load(lubridate, tidyr, dplyr, sf, stats19, tidyverse)
crash.link <- "https://data.dft.gov.uk/road-accidents-safety-data/dft-road-casualty-statistics-collision-1979-latest-published-year.csv" min.year.of.study <- 2021 options(timeout=10000) downloader::download(crash.link, "crash.csv") crash.df <- read.csv("crash.csv") crash.df <- subset(crash.df, crash.df$accident_year >= min.year.of.study) crash.df <- stats19::format_collisions(crash.df) crash.df$datetime[crash.df$time == "00:00"]`
Thanks, will take a look (and the other issue).
Keep them coming!