Documentation Index
Fetch the complete documentation index at: https://mintlify.com/namakala/inappropriate-acid-suppressor-agent-use/llms.txt
Use this file to discover all available pages before exploring further.
parse.R provides two lightweight utilities for getting raw data into the pipeline. lsData() discovers CSV files in the raw data directory and returns a named list of paths, while readData() loads a single file into a tidy data frame. Together they feed the first two targets in _targets.R.
lsData()
Parameters
Path to the raw data directory. Passed directly to
list.files() as the first argument.Additional arguments passed to
list.files(). Use pattern to filter files by extension or name.Returns
A named character vector of full relative file paths. Names are derived from each filename by stripping the leading directory path and file extension usinggsub(x = ., ".*_|\\w+/|\\.\\w*", "").
For example, a file at data/raw/data.csv gets the name "data".
Usage
_targets.R:
lsData() is called at the top level of _targets.R — outside the list() of targets — so the file paths are resolved at pipeline definition time.
readData()
Parameters
Full path to the CSV file to read. Typically one of the values from
lsData().Additional arguments passed to
readr::read_csv(). Use these to control column type guessing, locale, encoding, or to skip rows.Returns
A tibble (tidy data frame) with columns inferred from the CSV header row. Column types are guessed byreadr using the first 1000 rows by default.
Usage
_targets.R:
fpath is defined in the preceding tar_target(fpath, raws[["data"]], format = "file") target, which tells targets to track the file for changes.
readData() delegates entirely to readr::read_csv(), which handles a variety of CSV encodings and performs automatic type inference. If a column is being read as the wrong type, pass explicit col_types via ....