Skip to contents

Download the file of traffic accident data provided the National Police Agency's Web page.

Usage

download_accident_data(type, download_dir = getwd(), year = 2023)

Arguments

type

Type of data to download: one of "main", "sub", or "highway".

download_dir

A directory where downloaded file is to saved (default: getwd()).

year

Year the traffic accident data was recorded. Available from 2019 to 2023 (default: 2023).

Value

Path of the downloaded file (invisibly).

Details

The traffic accident data are divided into the following types:

  • "main" (honhyo): Basic data on traffic accidents.

  • "sub" (hojuhyo): Additional data related to the "main" data.

  • "highway" (kosokuhyo): Data on traffic accidents on highways.

You can specify the type of data directly via the type argument.

Examples

if (FALSE) { # \dontrun{
download_accident_data("main", "download-dir-path", 2023)
download_accident_data("sub", "download-dir-path", 2023)
download_accident_data("highway", "download-dir-path", 2023)
} # }