Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Midnight #236

Open
wengraf opened this issue May 10, 2024 · 3 comments
Open

Midnight #236

wengraf opened this issue May 10, 2024 · 3 comments

Comments

@wengraf
Copy link
Contributor

wengraf commented May 10, 2024

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.

@Robinlovelace
Copy link
Member

Oh.. Weird. Do you have an example bit of code that generates an incorrect result?

That will help demo when it's fixed 🤞

@wengraf
Copy link
Contributor Author

wengraf commented May 10, 2024

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"]`

@Robinlovelace
Copy link
Member

Thanks, will take a look (and the other issue).

Keep them coming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants