Skip to contents

Reads a dataset from a path, supporting .sas7bdat, .xpt, and .csv files. The original file path is retained as an attribute "path" on the returned data. The file modification time ("mtime") is also set as an attribute. If record_input is TRUE, records the input file path via utilscognigen::record_input().

Usage

sweet_read(path, ..., record_input = TRUE)

Arguments

path

Character. Path to the file to read.

...

Additional arguments passed to data.table::fread (for .CSVs).

record_input

Logical. If TRUE, records the input file path via utilscognigen::record_input(). Default is TRUE.

Value

A data.frame or data.table with attributes "path" and "mtime" and class "sweet_read".

Examples

if (FALSE) { # \dontrun{
df <- read_flexible("mydata.csv")
df2 <- read_flexible("mydata.csv", record_input = FALSE)
} # }