Returns summary information of recalls in the Vehicle Recalls Database based on a year range search term.
recall_by_years(start_year = 1900, end_year = 2100, limit = 25, api_key = NULL)
start_year | Start of year range. |
---|---|
end_year | End of year range. |
limit | Number indicating how many recall entries should be returned. Defaults to 25 which is the default of the API. |
api_key | API access key to use, if not set in environment. |
A tibble of recall summary information from the Vehicle Recalls Database. Includes six columns.
Queries the Vehicle Recalls Database API by year range and returns
summary recall information. If start_year
and/or end_year
are
not specified, the function will default to the start and/or end years
available in the database. Note that the year range is based on the
manufactured year and not the year a recall occurred.
An API key is required to run the function and query the Vehicle Recalls Database. The key can be acquired at https://tc.api.canada.ca/en/detail?api=VRDB.
The API key can be set in the environment using
Sys.setenv(VRD_API = 'your_API_key_here')
and will be used by the
function, or can be passed into the function using the api_key
argument.
if (FALSE) { recall_by_years(2010, 2012, limit = 100) API_KEY <- "xxxxxxxxxxx" recall_by_years(end_year = 1970, api_key = API_KEY) }