View source: R/function-map-total-n.R
| function_map_total_n | R Documentation |
*_map_total_n() functionsfunction_map_total_n() creates a total-n mapper from a basic
mapper such as grim_map(): a function for two groups whose statistics
are reported with the total sample size but without the group sizes, as
grim_map_total_n() is. It uses disperse_total() to create pairs of
hypothetical group sizes that add up to the total, and tests the reported
statistics against each pair.
See vignette("consistency-tests-in-depth"), section Total-n mapper.
function_map_total_n() is a developer tool: it may change in a minor
release, with a NEWS entry.
function_map_total_n(
.fn,
.reported,
.name_test,
.name_key_result = "consistency",
.name_class = NULL,
.dispersion = 0:5,
.n_min = 1L,
.n_max = NULL,
.constant = NULL,
...
)
.fn |
A basic mapper function such as |
.reported |
String. Names of the group-specific statistics reported
alongside the total, such as |
.name_test |
String (length 1). Plain-text name of the test, such as
|
.name_key_result |
(Experimental) String (length 1). Name of the key
result column. Default is |
.name_class |
String. Optionally, one or more classes to add to the
output. Default is |
.dispersion, .n_min, .n_max, .constant |
Passed on to
|
... |
These dots must be empty. |
To export a factory-made function from another package, follow the
purrr FAQ on adverbs;
see vignette("consistency-tests-in-depth"), section Context and
export.
A function such as these:
| Factory-made function | Reported statistics | Test vignette |
grim_map_total_n() | "x" | vignette("grim-in-depth") |
grimmer_map_total_n() | "x", "sd" | vignette("grimmer-in-depth") |
debit_map_total_n() | "x", "sd" | vignette("debit") |
The settings of .fn, i.e., its arguments after ..., such as
rounding, are arguments of this function as well, with the same
defaults. So are its helper arguments, such as items_averaged. Its ...
pass any other arguments on to .fn, which is only of use for a .fn
without ... of its own.
Name the factory-made function after .fn with
_total_n appended, as in grim_map_total_n() from grim_map(). The
output has the classes "scrutiny_map_total_n" and
"scrutiny_{tolower(.name_test)}_map_total_n". Prefix any class you add
via .name_class with your package's name, as in
"mypkg_schlim_map_total_n".
Bauer, P. J., & Francis, G. (2021). Expression of Concern: Is It Light or Dark? Recalling Moral Behavior Changes Perception of Brightness. Psychological Science, 32(12), 2042–2043. https://journals.sagepub.com/doi/10.1177/09567976211058727
function_map_seq()
# Function definition of `grim_map_total_n()`:
grim_map_total_n <- function_map_total_n(
.fn = grim_map,
.reported = "x",
.name_test = "GRIM"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.