ropensci/stats19

Error when downloading 2020 vehicles file

eugenividal opened this issue · 4 comments

Hi @Robinlovelace, I got the following error when trying to get the 2020 vehicles file. Any idea what can be the issue?

v20 = get_stats19(year = 2020, type = "vehicle")
Multiple matches. Which do you want to download?

1: dft-road-casualty-statistics-vehicle-2020.csv
2: dft-road-casualty-statistics-vehicle-e-scooter-2020.csv

Selection: 1
Files identified: dft-road-casualty-statistics-vehicle-2020.csv

   https://data.dft.gov.uk/road-accidents-safety-data/dft-road-casualty-statistics-vehicle-2020.csv
Data already exists in data_dir, not downloading
Data saved at C:\Users\geoevid\AppData\Local\Temp\RtmpCQ620V/dft-road-casualty-statistics-vehicle-2020.csv
 not found
Try running dl_stats19(), change arguments or try later.FALSE
Error in names(x) <- new_names : attempt to set an attribute on NULL

Not sure what the cause is, thanks for flagging the issue. It needs changes to the code in the package I think. In the meantime, have you tried downloading the .csv file from the link directly and formatting it with one of the 'format stats19' functions? That should get the same result.

Thanks, @Robinlovelace. Yes, I already got vehicles 2020 from DfT, but I didn't format it. I was able to merge this file with other years' vehicle files that I got from the package with no apparent problem. Or should I have used format_vehicles()?

Sounds good Eugeni.

Or should I have used format_vehicles()?

Yes I suggest trying format_vehicles(), keep us posted if it works.

Perfect! It works. I used format_vehicles() and can see that the category labels in vehicle 2020 (get directly from DfT) are now the same as in the rest of the vehicle files (from the package). Thanks!