default_stats_formats_labels {junco} | R Documentation |
Get default statistical methods and their associated formats, labels, and indent modifiers
Description
Utility functions to get valid statistic methods for different method groups
(.stats
) and their associated formats (.formats
), labels (.labels
), and indent modifiers
(.indent_mods
). This utility is used across junco
, but some of its working principles can be
seen in tern::analyze_vars()
. See notes to understand why this is experimental.
Usage
junco_get_stats(
method_groups = "analyze_vars_numeric",
stats_in = NULL,
custom_stats_in = NULL,
add_pval = FALSE
)
junco_get_formats_from_stats(stats, formats_in = NULL, levels_per_stats = NULL)
junco_get_labels_from_stats(
stats,
labels_in = NULL,
levels_per_stats = NULL,
label_attr_from_stats = NULL
)
get_label_attr_from_stats(x_stats)
junco_get_indents_from_stats(stats, indents_in = NULL, levels_per_stats = NULL)
format_stats(
x_stats,
method_groups,
stats_in,
formats_in,
labels_in,
indents_in
)
junco_default_stats
junco_default_formats
junco_default_labels
junco_default_indents
Arguments
method_groups |
( |
stats_in |
( |
custom_stats_in |
( |
add_pval |
( |
stats |
( |
formats_in |
(named |
levels_per_stats |
(named |
labels_in |
(named |
label_attr_from_stats |
(named |
x_stats |
( |
indents_in |
(named |
Format
-
junco_default_stats
is a named list of available statistics, with each element named for their corresponding statistical method group.
-
junco_default_formats
is a named vector of available default formats, with each element named for their corresponding statistic.
-
junco_default_labels
is a namedcharacter
vector of available default labels, with each element named for their corresponding statistic.
-
junco_default_indents
is a namedinteger
vector of available default indents, with each element named for their corresponding statistic. Only indentations different from zero need to be recorded here.
Details
Current choices for type
are counts
and numeric
for tern::analyze_vars()
and affect junco_get_stats()
.
Value
-
junco_get_stats()
returns acharacter
vector of statistical methods.
-
junco_get_formats_from_stats()
returns a named list of formats as strings or functions.
-
junco_get_labels_from_stats()
returns a named list of labels as strings.
-
junco_get_indents_from_stats()
returns a named list of indentation modifiers as integers. By default all of the indentations will be zero.
-
format_stats()
returns the correspondingly formattedrtables::in_rows()
result.
Functions
-
junco_get_stats()
: Get statistics available for a given method group (analyze function). To check available defaults seejunco_default_stats
list. -
junco_get_formats_from_stats()
: Get formats corresponding to a list of statistics. To check available defaults see listjunco_default_formats
. -
junco_get_labels_from_stats()
: Get labels corresponding to a list of statistics. To check for available defaults see listjunco_default_labels
. -
get_label_attr_from_stats()
: Get label attributes from statistics list. -
junco_get_indents_from_stats()
: Get row indent modifiers corresponding to a list of statistics/rows. -
format_stats()
: Format statistics results according to format specifications. -
junco_default_stats
: Named list of available statistics by method group forjunco
. -
junco_default_formats
: Named vector of default formats forjunco
. -
junco_default_labels
: Namedcharacter
vector of default labels forjunco
. -
junco_default_indents
: Namedinteger
vector of default indents forjunco
.
Note
These defaults are experimental because we use the names of functions to retrieve the default statistics. This should be generalized in groups of methods according to more reasonable groupings.
These functions have been modified from the tern
file utils_default_stats_formats_labels.R
.
This file contains junco
specific wrappers of functions called within the afun
functions,
in order to point to junco
specific default statistics, formats and labels.
Formats in tern
or junco
and rtables
can be functions that take in the table cell value and
return a string. This is well documented in vignette('custom_appearance', package = 'rtables')
.