fars_read: Read data from csv file

Description Usage Arguments Details Value Note Examples

Description

fars_read is a function that reads data from a csv file in the CURRENT working directory and returns it as an object of the "tbl_df" class.

Usage

1
fars_read(filename)

Arguments

filename

A character string containing the name of the csv file to be read, which must be at the CURRENT directory.

Details

The progress is not shown while the file is being read and all messages are omitted. This function uses the read_csv() function from the readr package. After reading the data from the csv file, the tbl_df() function from the dplyr package is called to convert the data into the tbl_df format before returing it.

Value

If the file exists, this function returns a data frame table. If the file doesn't exist it raises an error message.

Note

Examples

1
2
3
4
5
## Not run: 
fars_read("accident_2014.csv.bz2") # file in current working directory
fars_read("data123.csv") # Error: file 'data123.csv' does not exist.

## End(Not run)

lahstorti/FARS.functions documentation built on May 15, 2019, 3:32 p.m.