make_filename: Make Filename From Year

Description Usage Arguments Details Value Examples

View source: R/fars_functions.R

Description

This function takes a year as an argument and uses that to construct a valid filepath to the accident dataset for that year.

Usage

1

Arguments

year

The year you want to pull data from.

Details

For this function to work properly, a valid year must be provided. Character strings as argument will return invalid filepaths with NA. If you provide a year as for which no accident data is available as the argument to this function, it will return a filepath that may not refer to any existing file. This will not cause an error in this function but will cause problems if used as an argument in other functions within this package such as fars_read

Value

This function returns a valid filepath within your R working directory.

Examples

1
2
3
4
make_filename(2013)
make_filename(10)

The second example will work, but the filename does not point to anything.

alexmjn/advancedr documentation built on May 29, 2019, 5:57 p.m.