fars_read: Reads an accident file from the US FARS.

Description Usage Arguments Details Value Note Examples

View source: R/fars.R

Description

far_raed is a function which reads an accident data from the US FARS (Fatality Analysis Recording System), by yearly from 2013-2015.

Usage

1
fars_read(filename)

Arguments

filename

A chracter of filename of accident which has the form of "accident_2013.csv.bz2". The file sholud not be a vector.

Details

To import the accident data saved as CSV file, first uses function. And then converts to tabular data frame using a tbl_df function. If the file name does't exist, it throws an error with the file name does not exist.

Value

It returns a data fram of 50 variables where the number of rows varies by year. If the file does't exist it returns does not exist.

Note

To generate file name use: make_filename

Examples

1
2
3
4
5
6
library(dplyr)
year_input <- 2013
data <- year_input %>%
  make_filename %>%
  fars_read
head(data)

hahustat/farsdata documentation built on Sept. 29, 2020, 12:48 a.m.