Skip to contents

Testable core behind the inst/scripts/gcdriver.R command-line driver. Reads a CSV, runs cleangrowth on it (data-frame style), and writes the result to a CSV. Only the options in opts are forwarded, so cleangrowth()'s own defaults apply to everything else.

Usage

run_gc_cli(infile, outfile, opts = list())

Arguments

infile

Path to the input CSV. Read with data.table::fread. Must use the canonical column names (subjid, param, agedays, sex, measurement, optional id) unless remapped via the column-name options in opts.

outfile

Path to write the cleaned result to, via data.table::fwrite. Overwritten if it exists.

opts

Named list of arguments forwarded verbatim to cleangrowth() (already coerced to the right types). Typically built from command-line flags by the driver; may be supplied directly in tests or from other R code. An empty list runs cleangrowth() with all defaults.

Value

The output path, invisibly.

See also

cleangrowth; the command-line driver inst/scripts/gcdriver.R.

Examples

if (FALSE) { # \dontrun{
run_gc_cli("visits.csv", "cleaned.csv",
           opts = list(adult_cutpoint = 18, quietly = TRUE))
} # }