Description Usage Arguments Details Value See Also Examples
View source: R/fars_functions.R
This function takes a vector of years
, and returns a list of dplyr tibbles containting the
FARS data for that year. The tibble contians only the month of the accident an the year in the
format of the years
vector. This is primarily a helper function for
fars_summarize_years
as much of the data contained in the files is lost.
1 | fars_read_years(years)
|
years |
A vector of four-digit years of the FARS data to load. Currently only data from 2013-2015 are available.
|
Any component of years
which does not correspond to a valid filename will produce a warning, but a list
will still be returned, with NULL in position for each invalid component.
The FARS data can be found at the National Highway Traffic Safety Association
here.
2013-2015 data is distributed with this package. The location of the files can be found using
system.file('extdata',package='FARScoursera')
These files need to be in your working directory for this function to work correctly.
This function returns a list of dplyr tibbles containing FARS data for each year in years
.
The tibbles contain only the month and year of each accident, so the list is mostly of use as an
input into other functions. If any element in years
does not correspond to a valid FARS data
file, a warning is generated and the corresponding component of the returned list is NULL
1 2 3 | ## Not run: fars_read_years(2013:2015)
## Not run: fars_read_years(c('2013','2014','2015'))
## Not run: fars_read_years(2012:2016) # shows effect of invalid years in input
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.