make_filename: Create a vaild FARS filename for a given year

Description Usage Arguments Value See Also Examples

View source: R/fars_functions.R

Description

FARS files are of the form 'accident_YEAR.csv.bz2'. This function takes year as an input, and returns the file name in the correct form. year must be a scalar of a type coercible into an integer, otherwise it will throw an error. No guarantee is made that the file of the name created by this function exists

Usage

1

Arguments

year

A four-digit year, in a format coerceable into an integer. Currently, only files covering 2013-2013 are valid. If year cannot be coerced to an integer, the function will throw an error

Value

This function returns a string of the form 'accident_YEAR.csv.bz2', with YEAR replaced by whatever is passed by year. A string is returned, although a warning is givin if year cannot be coerced to an integer, even though that may not form a valid filename. No path is prepended

See Also

fars_read To easily load the file named in the returned string

Examples

1
2
3
4
make_filename(2013)
make_filename('2014')
## Not run: fars_read(make_filename(2013))
## Not run: make_filename(12345) # still returns a filename, but the file does not exist

jmmark/FARScoursera documentation built on May 19, 2019, 1:54 p.m.