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

No data for 2022? #234

Closed
Robinlovelace opened this issue Apr 3, 2024 · 2 comments
Closed

No data for 2022? #234

Robinlovelace opened this issue Apr 3, 2024 · 2 comments

Comments

@Robinlovelace
Copy link
Member

I got an email asking about data for 2022. Seems to download fine to me, documenting here for reference:

remotes::install_cran("stats19")
#> Skipping install of 'stats19' from a cran remote, the SHA1 (3.0.3) has not changed since last install.
#>   Use `force = TRUE` to force installation
library(stats19)
#> Data provided under OGL v3.0. Cite the source and link to:
#> www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
collisions_2022 = get_stats19(year = 2022, type = "collision")
#> Files identified: dft-road-casualty-statistics-collision-2022.csv
#>    https://data.dft.gov.uk/road-accidents-safety-data/dft-road-casualty-statistics-collision-2022.csv
#> Data already exists in data_dir, not downloading
#> Reading in:
#> ~/data/stats19/dft-road-casualty-statistics-collision-2022.csv
#> Rows: 106004 Columns: 36
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr   (6): accident_index, accident_reference, date, local_authority_ons_dis...
#> dbl  (29): accident_year, location_easting_osgr, location_northing_osgr, lon...
#> time  (1): time
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> date and time columns present, creating formatted datetime column
head(collisions_2022)
#> # A tibble: 6 × 37
#>   accident_index accident_year accident_reference location_easting_osgr
#>   <chr>                  <dbl> <chr>                              <dbl>
#> 1 2022010352073           2022 010352073                         525199
#> 2 2022010352573           2022 010352573                         546214
#> 3 2022010352575           2022 010352575                         551119
#> 4 2022010352578           2022 010352578                         528889
#> 5 2022010352580           2022 010352580                         539773
#> 6 2022010352588           2022 010352588                         543159
#> # ℹ 33 more variables: location_northing_osgr <dbl>, longitude <dbl>,
#> #   latitude <dbl>, police_force <chr>, accident_severity <chr>,
#> #   number_of_vehicles <dbl>, number_of_casualties <dbl>, date <date>,
#> #   day_of_week <chr>, time <time>, local_authority_district <chr>,
#> #   local_authority_ons_district <chr>, local_authority_highway <chr>,
#> #   first_road_class <chr>, first_road_number <chr>, road_type <chr>,
#> #   speed_limit <dbl>, junction_detail <chr>, junction_control <chr>, …

Created on 2024-04-03 with reprex v2.1.0

@layik
Copy link
Member

layik commented Jul 19, 2024

Just went over the tests and this is covered in the tests. Thanks Robin. Closing

@layik layik closed this as completed Jul 19, 2024
@Robinlovelace
Copy link
Member Author

Thanks Layik 🙏

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