Skip to contents

Split on levels within a variable

Usage

VarLevelSplit(
  var,
  split_label,
  labels_var = NULL,
  cfun = NULL,
  cformat = NULL,
  cna_str = NA_character_,
  split_fun = NULL,
  split_format = NULL,
  split_na_str = NA_character_,
  valorder = NULL,
  split_name = var,
  child_labels = c("default", "visible", "hidden"),
  extra_args = list(),
  indent_mod = 0L,
  label_pos = c("topleft", "hidden", "visible"),
  cindent_mod = 0L,
  cvar = "",
  cextra_args = list(),
  page_prefix = NA_character_,
  section_div = NA_character_
)

VarLevWBaselineSplit(
  var,
  ref_group,
  labels_var = var,
  split_label,
  split_fun = NULL,
  label_fstr = "%s - %s",
  cfun = NULL,
  cformat = NULL,
  cna_str = NA_character_,
  cvar = "",
  split_format = NULL,
  split_na_str = NA_character_,
  valorder = NULL,
  split_name = var,
  extra_args = list()
)

Arguments

var

(string)
variable name.

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).

labels_var

(string)
name of variable containing labels to be displayed for the values of var.

cfun

(list, function, or NULL)
tabulation function(s) for creating content rows. Must accept x or df as first parameter. Must accept labelstr as the second argument. Can optionally accept all optional arguments accepted by analysis functions. See analyze().

cformat

(string, function, or list)
format for content rows.

cna_str

(character)
NA string for use with cformat for content table.

split_fun

(function or NULL)
custom splitting function. See custom_split_funs.

split_format

(string, function, or list)
default format associated with the split being created.

split_na_str

(character)
NA string vector for use with split_format.

valorder

(character)
the order that the split children should appear in resulting table.

split_name

(string)
name associated with the split (for pathing, etc.).

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.

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.

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). For analyze calls, "default" indicates that the variable should be visible if and only if multiple variables are analyzed at the same level of nesting.

cindent_mod

(numeric(1))
the indent modifier for the content tables generated by this split.

cvar

(string)
the variable, if any, that the content function should accept. Defaults to NA.

cextra_args

(list)
extra arguments to be passed to the content function when tabulating row group summaries.

page_prefix

(string)
prefix to be appended with the split value when forcing pagination between the children of a split/table.

section_div

(string)
string which should be repeated as a section divider after each group defined by this split instruction, or NA_character_ (the default) for no section divider.

ref_group

(character)
value of var to be taken as the ref_group/control to be compared against.

label_fstr

(string)
a sprintf style 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".

Value

a VarLevelSplit object.

Author

Gabriel Becker