read_data {daiquiri} | R Documentation |
Read delimited data for optimal use with daiquiri
Description
Popular file readers such as readr::read_delim()
perform datatype
conversion by default, which can interfere with daiquiri's ability to detect
non-conformant values. Use this function instead to ensure optimal
compatibility with daiquiri's features.
Usage
read_data(
file,
delim = NULL,
col_names = TRUE,
quote = "\"",
trim_ws = TRUE,
comment = "",
skip = 0,
n_max = Inf,
show_progress = TRUE
)
Arguments
file |
A string containing path of file containing data to load, or a
URL starting |
delim |
Single character used to separate fields within a record. E.g.
|
col_names |
Either |
quote |
Single character used to quote strings. |
trim_ws |
Should leading and trailing whitespace be trimmed from each field? |
comment |
A string used to identify comments. Any text after the comment characters will be silently ignored |
skip |
Number of lines to skip before reading data. If |
n_max |
Maximum number of lines to read. |
show_progress |
Display a progress bar? Default = |
Details
This function is aimed at non-expert users of R, and operates as a restricted
implementation of readr::read_delim()
. If you prefer to use read_delim()
directly, ensure you set the following parameters: col_types = readr::cols(.default = "c")
and na = character()
Value
A data frame
See Also
field_types()
, field_types_available()
,
aggregate_data()
, report_data()
,
daiquiri_report()
Examples
raw_data <- read_data(
system.file("extdata", "example_prescriptions.csv", package = "daiquiri"),
delim = ",",
col_names = TRUE
)
head(raw_data)