Description Usage Arguments Details Value Note Examples
This function generates the filename for a FARS (Fatality Analysis Reporting System) datafile for the year passed as the calling parameter. It is an internal (supporting) function used by other functions in this package.
1 | make_filename(year)
|
year |
An integer, or a value coercible to an integer. If not coercible, then an invalid filename will be generated containing "NA" as the year in the file name – accident_NA.csv.bz2 – which doesn't exist in the FARS database. |
This function uses the year, input parameter, to generate the file name for the FARS data file. It converts the year into an integer and then uses the sprintf() function to format the filename by prefixing "accident_" to the year and siffixing ".csv.bz2".
This function returns a character string representing the filename.
No other input validation is performed. It requires no other packages to be imported.
1 2 3 4 5 6 7 8 | ## Not run:
make_filename(2016) # generates "accident_2016.csv.bz2"
make_filename("2016") # generates "accident_2016.csv.bz2"
make_filename(2016.5) # generates "accident_2016.csv.bz2"
make_filename("2016.5") # generates "accident_2016.csv.bz2"
make_filename("DEC-2016") # generates "accident_NA.csv.bz2"
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.