ropensci / stats19

R package for working with open road traffic casualty data from Great Britain
https://docs.ropensci.org/stats19
GNU General Public License v3.0
62 stars 19 forks source link

No data for 2022? #234

Closed Robinlovelace closed 3 months ago

Robinlovelace commented 7 months ago

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 commented 3 months ago

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

Robinlovelace commented 3 months ago

Thanks Layik :pray: