Description Usage Arguments Details Value See Also Examples
View source: R/fars_functions.R
A function for loading the FARS data as specified by filename
.
If filename
exists it returns the data as a dplyr tbl_df
. If it
does not exist, it stops with an error.
1 | fars_read(filename)
|
filename |
A string containing the filename to be read from the FARS data. be sure to include a valid path if the data are not in the current working directory. See details below for finding the data |
The FARS data can be found at the National Highway Traffic Safety Association here. If you choose to download it directly, be sure to include the correct path to the data.
Data for 2013-2015 are included in the distribution of this package in the extdata
directory. To find it, use the system.file()
function. For example,
system.file('extdata','accident_2013.csv.bz2',package = 'FARScoursera')
This function returns a dplyr tibble containing the data. If filename
is not valid,
the function stops with an error message
make_filename
for convenient creation of valid filename
input
1 2 3 4 | ## Not run: fars_read('accident_2013.csv.bz2')
fars_read(system.file('extdata','accident_2013.csv.bz2',package = 'FARScoursera'))
## Not run: fars_read(make_filename(2013)
## Not run: fars_read('not_a_valid_file') #shows the expected errors
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.