get_stats19: Download, read and format STATS19 data in one function.

Description Usage Arguments Details See Also Examples

View source: R/get.R

Description

Download, read and format STATS19 data in one function.

Usage

1
2
get_stats19(year = NULL, type = "accidents", data_dir = tempdir(),
  file_name = NULL, format = 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.

format

Switch to return raw read from file, default is TRUE.

Details

This function utilizes dl_stats19 and read_* functions and retuns a df. The file downloaded would be for a specific year (e.g 2017).

As this function uses dl_stats19 function, it can download many MB of data so ensure you have a sufficient disk space.

See Also

dl_stats19()

read_accidents()

Examples

1
2
get_stats19(year = 2017)
get_stats19(year = 2009)

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