Layouting function argument conventions
Usage
lyt_args(
lyt,
var,
vars,
label,
labels_var,
varlabels,
varnames,
split_format,
split_na_str,
nested,
format,
cfun,
cformat,
cna_str,
split_fun,
split_name,
split_label,
afun,
inclNAs,
valorder,
ref_group,
compfun,
label_fstr,
child_labels,
extra_args,
name,
cuts,
cutlabels,
cutfun,
cutlabelfun,
cumulative,
indent_mod,
show_labels,
label_pos,
var_labels,
cvar,
table_names,
topleft,
align,
page_by,
page_prefix,
format_na_str,
section_div,
na_str,
show_colcounts,
colcount_format,
parent_name
)Arguments
- lyt
(
PreDataTableLayouts)
layout object pre-data used for tabulation.- var
(
string)
variable name.- vars
(
character)
vector of variable names.- label
(
string)
a label (not to be confused with the name) for the object/structure.- labels_var
(
string)
name of variable containing labels to be displayed for the values ofvar.- varlabels
(
character)
vector of labels forvars.- varnames
(
character)
vector of names forvarswhich will appear in pathing. Whenvarsare all unique this will be the variable names. If not, these will be variable names with suffixes as necessary to enforce uniqueness.- split_format
(
string,function, orlist)
default format associated with the split being created.- split_na_str
(
character)
NA string vector for use withsplit_format.- nested
(
logical)
whether this layout instruction should be applied within the existing layout structure if possible (TRUE, the default) or as a new top-level element (FALSE). Ignored if it would nest a split underneath analyses, which is not allowed.- format
(
string,function, orlist)
format associated with this split. Formats can be declared via strings ("xx.x") or function. In cases such asanalyzecalls, they can be character vectors or lists of functions. Seeformatters::list_valid_format_labels()for a list of all available format strings.- cfun
(
list,function, orNULL)
tabulation function(s) for creating content rows. Must acceptxordfas first parameter. Must acceptlabelstras the second argument. Can optionally accept all optional arguments accepted by analysis functions. Seeanalyze().- cformat
(
string,function, orlist)
format for content rows.- cna_str
(
character)
NA string for use withcformatfor content table.- split_fun
(
functionorNULL)
custom splitting function. See custom_split_funs.- split_name
(
string)
name associated with the split (for pathing, etc.).- split_label
(
string)
label to be associated with the table generated by the split. Not to be confused with labels assigned to each child (which are based on the data and type of split during tabulation).- afun
(
function)
analysis function. Must acceptxordfas its first parameter. Can optionally take other parameters which will be populated by the tabulation framework. See Details inanalyze().- inclNAs
(
logical)
whether NA observations in thevarvariable(s) should be included when performing the analysis. Defaults toFALSE.- valorder
(
character)
the order that the split children should appear in resulting table.- ref_group
(
character)
value ofvarto be taken as theref_group/control to be compared against.- compfun
(
functionorstring)
the comparison function which accepts the analysis function outputs for two different partitions and returns a single value. Defaults to subtraction. If a string, taken as the name of a function.- label_fstr
(
string)
asprintfstyle format string. For non-comparison splits, it can contain up to one"\%s"which takes the current split value and generates the row/column label. For comparison-based splits it can contain up to two"\%s".- child_labels
(
string)
the display behavior for the labels (i.e. label rows) of the children of this split. Accepts"default","visible", and"hidden". Defaults to"default"which flags the label row as visible only if the child has 0 content rows.- extra_args
(
list)
extra arguments to be passed to the tabulation function. Element position in the list corresponds to the children of this split. Named elements in the child-specific lists are ignored if they do not match a formal argument of the tabulation function.- name
(
string)
name of the split/table/row being created. Defaults to the value of the corresponding label, but is not required to be.- cuts
(
numeric)
cuts to use.- cutlabels
(
characterorNULL)
labels for the cuts.- cutfun
(
function)
function which accepts the full vector ofvarvalues and returns cut points to be used (viacut) when splitting data during tabulation.- cutlabelfun
(
function)
function which returns either labels for the cuts orNULLwhen passed the return value ofcutfun.- cumulative
(
flag)
whether the cuts should be treated as cumulative. Defaults toFALSE.- indent_mod
(
numeric)
modifier for the default indent position for the structure created by this function (subtable, content table, or row) and all of that structure's children. Defaults to 0, which corresponds to the unmodified default behavior.- show_labels
(
string)
whether the variable labels corresponding to the variable(s) invarsshould be visible in the resulting table.- label_pos
(
string)
location where the variable label should be displayed. Accepts"hidden"(default for non-analyze row splits),"visible","topleft", and"default"(for analyze splits only). Foranalyzecalls,"default"indicates that the variable should be visible if and only if multiple variables are analyzed at the same level of nesting.- var_labels
(
character)
vector of labels for one or more variables.- cvar
(
string)
the variable, if any, that the content function should accept. Defaults toNA.- table_names
(
character)
names for the tables representing each atomic analysis. Defaults tovar.- topleft
(
character)
override values for the "top left" material to be displayed during printing.- align
(
stringorNULL)
alignment the value should be rendered with. Defaults to"center"ifNULLis used. Seeformatters::list_valid_aligns()for all currently supported alignments.- page_by
(
flag)
whether pagination should be forced between different children resulting from this split. An error will occur if the selected split does not contain at least one value that is notNA.- page_prefix
(
string)
prefix to be appended with the split value when forcing pagination between the children of a split/table.- format_na_str
(
string)
string which should be displayed when formatted if this cell's value(s) are allNA.- section_div
(
string)
string which should be repeated as a section divider after each group defined by this split instruction, orNA_character_(the default) for no section divider.- na_str
(
string)
string that should be displayed when the value ofxis missing. Defaults to"NA".- show_colcounts
(
logical(1))
should column counts be displayed at the level facets created by this split. Defaults toFALSE.- colcount_format
(
character(1))
ifshow_colcountsisTRUE, the format which should be used to display column counts for facets generated by this split. Defaults to"(N=xx)".- parent_name
(
character(1))
Name to assign to the table corresponding to the split or group of sibling analyses, forsplit_rows_by*andanalyze*when analyzing more than one variable, respectively. Ignored when analyzing a single variable.
See also
Other conventions:
compat_args(),
constr_args(),
gen_args(),
sf_args()