Description Usage Arguments Value Examples
View source: R/fars_functions.R
fars_read_years()
reads multiple years' data using
fars::make_filename
and fars::fars_read
.
Note that only the year and MONTH variables are kept, therefore
the output is most suitable for counting observations read in.
1 | fars_read_years(years, internal = TRUE)
|
years |
Integer vector containing one or more years for which data exists. |
internal |
Logical value indicating whether or not the package example data is used. Defaults to TRUE. |
Returns a list the same length as the input, with each element
corresponds to a year.
Years successfully read generate a n x 2 tibble
where n is the number of data rows imported, and the columns are 'MONTH' (an integer
1 to 12) and 'year'.
An element is NULL if a year is invalid, or the 'MONTH' variable is not
present in the data.
This function is called by fars::fars_summarize_years
,
and is most useful in that context.
1 2 3 | df1 <- fars_read_years(2013)
df2 <- fars_read_years(2013:2015)
fars_read_years(2012) # Returns 'invalid year'
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.