make_filename: Make file name

Description Usage Arguments Details Value Note Examples

View source: R/fars_functions.R

Description

This function takes a four-digit number as its argument and returns a character vector containing a formatted combination of filename text template and year variable.

Usage

1

Arguments

year

A four-digit number indicating the year in which the data collected.

Details

This function takes a four-digit number as its year argument indicating the year in which the data has been collected. Then it uses as.integer to coerce it into integer type. After that the function calls sprintf to combine the format string for filename with the year variable. The length of the output will be equal to the longest input.

Value

This function returns a character vector containing a formatted combination of file name template in text and year variable.

Note

Because formats d can only be used for integer values or sometimes for logical values, the function use as.integer to turn the entry for year argument into integer value.

Examples

1
2
3
4
## Not run: 
make_filename(2013)

## End(Not run)

AnoushiravanR/fars documentation built on Jan. 19, 2021, 5:16 p.m.