Description Usage Arguments Details Value Examples
The function reads data files based on a vector of years given. For each data file, it adds the year to the data frame as a new variable, and then extracts the MONTH, and year variables of the data frame.
1 | fars_read_years(years)
|
years |
An integer number to be passed to the standard filename. |
The function uses lapply on the vector of arguments. For each element of the vector, it attempts to create a filename with make_filename(), read the file with fars_read(), add the year variable with dplyr::mutate(), and finally select the variables with dplyr:select(). fars_read() and the dplyr functions are wrapped in a tryCatch() function, which will print an error and return NULL when an element of the vector of years is invalid.
The function returns a list of data frames.
1 2 3 4 | ## Not run:
fars_read_years(2013)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.