Centralised setter / getter for the package's tunables (output directory,
default rendering, p-value digits, etc). Until now these have been read at
each call site via getOption("cctu_<name>", default = <D>), with the
default literal duplicated in every formal-argument list. cctu_options()
replaces those scattered defaults with one table.
Value
When called with no arguments and reset = FALSE, a named list
of currently effective option values (after applying the precedence rule).
When setting, returns the previous values of the affected options
invisibly, in the style of base::options().
Details
Precedence. cctu_opt(name) resolves a
value by checking, in order: (1) the base R option cctu_<name> if
set via base::options(); (2) the value stashed by cctu_options()
in the package's internal environment; (3) the packaged default in
.cctu_default_opts. Setting an option via base::options()
therefore still wins, which preserves the existing workflow for users who
set things in .Rprofile.
Available options
digitsSignificant digits for numeric summaries (default 3).
digits_pctDecimal places for percentages (default 0).
subjid_stringColumn name identifying a subject (default
"subjid").print_plotWhether
cttab()prints a summary plot (defaultTRUE).nestHow to nest variables in the output (default
"split") ofcttab().render_numNumeric statistic spec used by
cttab()(default"Median [Min, Max]").blindedSuppress the grouping variable in
cttab()output (defaultFALSE).outputTop-level output directory (default
"Output").p_digitsDigits for p-values (default 4).
rm_emptyapply_macro_dict()'s empty-row/column policy (default"both").na_to_emptyRender
NAas empty inwrite_table()(defaultFALSE).source_localcctu::source()default forlocal(defaultFALSE).fig_formatFigure formats for
write_ggplot()(defaultc("png", "eps")).
Examples
old <- cctu_options(digits = 4, p_digits = 3)
cctu_options()$digits # 4
#> [1] 4
cctu_options(reset = TRUE) # restore packaged defaults
do.call(cctu_options, old) # or restore manually