read_file: Context-sensitive file reader

Description Usage Arguments Details Examples

Description

Context-sensitive file reader

Usage

1
read_file(filename, format = "unknown")

Arguments

filename

Fully qualified path and filename of data file to be read. Both compresed and uncompressed data can be read, although it is assumed that the underlying data are in comma-separated value (CSV) of feather formats. The type of file is inferred from the file extension.

format

String describing the format of the file, used in cases where the file encoding cannot be inferred from the file extension(s). Defaults to "unknown".

Details

This function is a general purpose file reader for data in comma- separated value (CSV) format. The goal is for the user to be able to specify the filename containing the data without having to worry about which reader to use or handle different behaviors of specific readers. If the file extension is supported "it just works" without casting or wrapping the reader. In current version it handles feather or uncompressed CSV files, as well as those with gzip, zip, or xz compression. The data are returned in a data frame or tibble (depending upon the reader).

Examples

1
2
trip_list <- read_file("combined_trips.csv.gz")
trip list <- read_file("https:://faf.fhwa.gov/faf44.zip", format = "csv")

rickdonnelly/pcvmodr documentation built on May 14, 2019, 8:17 a.m.