Learn R Programming

stats19 (version 4.1.0)

dl_stats19: Download STATS19 data for a year

Description

Download STATS19 data for a year

Usage

dl_stats19(
  year = NULL,
  type = NULL,
  data_dir = get_data_directory(),
  file_name = NULL,
  ask = FALSE,
  silent = FALSE,
  timeout = 600
)

Arguments

year

Single year, or vector of years, for which data are to be read. Use "all" (or any year before 2021) to read the full 1979-latest dataset in one file; see find_file_name() for details.

type

One of 'collision', 'casualty', 'Vehicle'; defaults to 'collision'.

data_dir

Where sets of downloaded data would be found.

file_name

Character string of a specific STATS19 CSV filename to download/read. If NULL, filenames are inferred from year and type.

ask

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

silent

Boolean. If FALSE (default value), display useful progress messages on the screen.

timeout

Timeout in seconds for the download if current option is less than this value. Defaults to 600 (10 minutes).

Examples

Run this code
# \donttest{
if (curl::has_internet()) {
  # type by default is collisions table
  dl_stats19(year = 2022)
}
# }

Run the code above in your browser using DataLab