fars_read: Read data file

Description Usage Arguments Details Value See Also Examples

View source: R/fars_functions.R

Description

Reads file with '.csv/.bz2' extensions into R workspace using readr library and converts it to a data.frame using the dplyr tbl_df function. If file_name not found function is stopped and "file does not exist" warning is returned.

Usage

1
fars_read(filename)

Arguments

filename

File is .csv or .bz2 compressed file

Details

This is a helper function used with other FARS family functions in this package. Specifically it is called in fars_read_years, fars_summarize_years and fars_map_state.

Value

If file name exists in current working directory, returns data.frame class object. If file name not found, function stopped and "file does not exist" warning returned.

See Also

fars_read_years for reading and subsetting multiple FARS files into a single data.frame

Examples

1
2
3
4
5
## Not run: 
df <- fars_read("data_file.csv")
df <- fars_read("data_file.csv.bz2")

## End(Not run)

connermcb/FARSfunctions documentation built on May 18, 2019, 8:11 p.m.