fars_read_years: Load FARS data for multiple years

Description Usage Arguments Value Note Examples

Description

This function loads data from FARS data files and puts them in a list of tibbles, year by year.

Usage

1

Arguments

years

a vector or a list with years

Value

a list with data tibbles year by year

Note

Missing data for any of the requested years will result in a warning and a NULL in a coresponding place in a return list. Set the working directory before running this function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# good years, but bad path
fars_from_2013_to_2015 <- fars_read_years(2013:2015)
fars_from_2013_to_2015
# the directory with data files must be a working directory
setwd("data")
fars_from_2013_to_2015 <- fars_read_years(2013:2015)
str(fars_from_2013_to_2015)
# invalid range results in NULLs
fars_from_2010_to_2013 <- fars_read_years(2010:2013)
str(fars_from_2013_to_2015)

rafal-gl/package_coursera documentation built on May 20, 2019, 5:58 p.m.