safe_read_csv: Safe and fast reading of CSV files

Description Usage Arguments Details Value

View source: R/safe_read_csv.R

Description

A convenient wrapper to data.table::fread() enabling a safe reading mode while still being fast.

Usage

1
2
3

Arguments

x

a character. A file path pointing to a CSV file.

...

additional arguments. For safe_read_ops(), these will either be added to the list or override default values. For safe_read_csv(), these will be first passed to safe_read_csv() and then to data.table::fread().

Details

Function safe_read_csv() implements 4 tests on x:

If all tests are passed, then the file will be read with some pre-defined convenient data.table::fread() parameters. Any error and/or warning messages encountered by this function will be conveyed to the user.

The user can consult the list of default values passed to data.table::fread() by calling safe_read_ops(). These options can be overriden through argument ... of safe_read_csv().

Value

Function safe_read_csv() returns a data.table. There is one exception: if the data.table option of data.table::fread() is passed to safe_read_csv() with a FALSE value, a data.frame will be returned.

Function safe_read_ops() returns a named list.


jeanmathieupotvin/cargo documentation built on Oct. 27, 2020, 5:22 p.m.