fars_read: Import into R ".csv.bz2" Data from US National Highway...

Description Usage Arguments Details Value Examples

Description

The function loads into R bz2-compressed CSV for the year of interest. Canonical filename can be conveniently constructed with the function make_filename.

Usage

1
fars_read(filename)

Arguments

filename

name (character string) of the file to be imported

Details

The function uses readr::read_csv to import the file and dplyr::tbl_df to construct the dataframe. It will not show how it formatted each column nor its loading progress. If it fails to find a specified file, it will throw an error, notifying the user that the file does not exist. The function assumes that the file is in the current working directory.

Value

The function returns a tibble (a tidyverse version of the dataframe) with the data of interest.

Examples

1
2
3
4
5
## Not run: 
fars_read("accident_2013.csv.bz2")
fars_read(make_filename(2013))

## End(Not run)

bzunar/trafficSafety documentation built on June 5, 2019, 7:57 a.m.