dl_stats19: Download STATS19 data for a year or range of two years.

Description Usage Arguments Details See Also Examples

View source: R/dl.R

Description

Download STATS19 data for a year or range of two years.

Usage

1
2
dl_stats19(year = NULL, type = NULL, data_dir = tempdir(),
  file_name = NULL, ask = TRUE)

Arguments

year

Single year for which file is to be downloaded.

type

One of 'Accidents', 'Casualties', 'Vehicles'; defaults to 'Accidents'. Or any variation of to search the file names with such as "acc" or "accid".

data_dir

Parent directory for all downloaded files. Defaults to tempdir().

file_name

The file name (DfT named) to download.

ask

Should you be asked whether or not to download the files? TRUE by default.

Details

This function downloads and unzips UK road crash data. It results in unzipped .csv files that are put in the temporary directory specified by tempdir() or provided data_dir.

The file downloaded would be for a specific year (e.g. 2017). It could also be a file containing data for a range of two (e.g. 2005-2014).

The dl_* functions can download many MB of data so ensure you have a sufficient internet access and hard disk space.

See Also

get_stats19()

Examples

1
2
3
4
5
6
dl_stats19(year = 2017) # interactively select files...
# now you can read-in the data
dl_stats19(year = 2009)
dl_stats19(year = 2009, type = "casualties")
dl_stats19(type = "casualties")
dl_stats19(year = 1985)

ITSLeeds/stats19 documentation built on May 4, 2019, 7:35 a.m.