Description Usage Arguments Details Value Note See Also Examples
Using a list of years as input, this function reads the collect the available data in the Fatality Analysis Reporting System dataset. It then counts the number of accident per month.
1 | fars_summarize_years(years,fars_path)
|
years |
a list of values corresponding to year |
fars_path |
charcter string correspondinf to the directory containing the fars data |
Uses fars_read_years
then transforms the list into a data.frame.
The data is aggregated by the MONTH and year columns and summerize with the count n()
function.
a data frame table with columns
month
: month number
year
: four digit year
n
: the number of corresponding rows in the dataset interpreted as the number of accidents
only years present in the dataset will be represented
this function require to run from the directory contianing the datasets
fars_read_years
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
# need to be in the same directory as the data
setwd("data")
# with one year
fars_summarize_years(2013)
# with multiple years
fars_summarize_years(2013:2015)
# with characters
fars_summarize_years(c("2013","2015"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.