fars_vars: Get variables and variable attributes for the Fatality...

View source: R/fars_vars.R

fars_varsR Documentation

Get variables and variable attributes for the Fatality Analysis Reporting System (FARS) API

Description

By default, this function returns the returns the list of variables for the data year specified. If vars is "make", "model", or "bodytype", the function returns #' list of variable attributes for the specified variable name or attributes for make model and body type specified in the FARS dataset.

Usage

fars_vars(year, var = NULL, make = NULL, model = NULL)

Arguments

year

Case year. Year must be between 2010 and 2019.

var

Default NULL. Supported values are "make", "model", and "bodytype". Using the var parameter returns variable attributes for the specified variable name or attributes for make model and body type specified in the dataset.

make

Integer. Make ID number. Required to return variables for "model" and "bodytype". Get a list of make ID numbers using the "make" var for the selected year, e.g. fars_vars(year = 2010, var = "make").

model

Integer. Model ID number. Required to return variables for "bodytype". Get a list of model ID numbers using the "model" var for the selected year with a valid make ID number, e.g. fars_vars(year = 2010, var = "model", make = 37)

Examples


head(fars_vars(year = 2022, var = "make"), 5)

head(fars_vars(year = 2022, var = "model", make = 12), 5)

fars_vars(year = 2022, var = "bodytype", make = 12, model = 37)


elipousson/crashapi documentation built on Sept. 6, 2024, 9:01 a.m.