Get crash data using get_md_open_data()
. format_md_crash_data works with
a data frame of crash data from get_md_crash_data()
when type = "crashes".
format_md_crashes_person()
formats data when type = "persons".
format_md_crashes()
calls one or the other depending on the type
parameter.
Usage
get_md_crash_data(
location = NULL,
...,
report_no = NULL,
where = NULL,
type = "crashes"
)
format_md_crash_data(data, type = "crashes", drop_code = TRUE, ...)
format_md_crashes(data)
format_md_crash_date(data, cols = c("acc_date", "acc_time"))
format_md_crashes_person(
data,
start_year = 2022,
end_year = 2022,
na_dates = c("1/1/1900", "19000101", "19001111", "19001212", "19200202")
)
Arguments
- location
A
sf
orsfc
object covering the location to return crash data.- ...
Passed to
get_md_open_data()
forget_md_crash_data()
or passed to specified formatting functions when used withformat_md_crash_data()
.- report_no
Crash report numbers. Defaults to
NULL
. Optionally used to filter results if type is "persons" or "vehicles".- where
A query parameter passed to
get_md_open_data()
- type
Supported options include "crashes" (default), "persons" (or "crashes_person"), and "vehicles" (or "crashes_vehicle").
- data
Data frame with Maryland vehicular crash data; typically from
get_md_crash_data
- drop_code
If
TRUE
(default), drop all columns that end with "code"- cols
Column names to use with
format_md_crash_date()
.- start_year, end_year
Start and end year to use when checking validity of birth dates.
- na_dates
Character vector of invalid dates to replace with a
NA_character_
value.
Examples
if (FALSE) { # \dontrun{
if (interactive()) {
get_md_crash_data(
where = "(year = '2020') AND (quarter = 'Q2')",
name_col = "county_desc",
name = "Cecil"
)
}
} # }