Description Usage Arguments Details Value Examples
View source: R/fars_functions.R
The function fars_read_years
can load several files corresponding to
their year into R, since it gets a list/vector of years as input and returns
the month and years of that dataframes.
It is still possible to only load one dataset and manipulate it.
The lapply functionality allows to create for each element (year of years)
the zipped file name, check whether it exists with tryCatch
and if it
throws an error, write out a warning that the year is invalid and return
NULL
.
If the file exists, the inner of tryCatch
is executed and the data is
loaded into R. Then a new column year is created, which is the current
element of years chosen in lapply and only Month and year of the dataset are
selected.
1 | fars_read_years(years)
|
years |
A list/vector containing the years for which data should be loaded and month + year are extracted |
Errors occur in the same cases as for make_filename
, but not for
fars_read
, since this is part of the tryCatch.
A dataframe containing the month and the year of each observation of the zipped file - the year coming as input and has to be part of the file name.
1 | # fars_read_years(2013)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.