make_scale | R Documentation |
This function creates a scale by calculating the mean of a set of items,
and prints and returns descriptives that allow to assess internal consistency
and spread. It is primarily based on the psych::alpha
function, with
more parsimonious output and some added functionality.
make_scale( df, scale_items, scale_name, reverse = c("auto", "none", "spec"), reverse_items = NULL, two_items_reliability = c("spearman_brown", "cron_alpha", "r"), r_key = NULL, print_hist = TRUE, print_desc = TRUE, return_list = FALSE )
df |
A dataframe |
scale_items |
Character vector with names of scale items (variables in df) |
scale_name |
Name of the scale |
reverse |
Should scale items be reverse coded? One of "auto" - items are
reversed if that contributes to scale consistency, "none" - no items reversed,
or "spec" - items specific in |
reverse_items |
Character vector with names of scale items to be reversed (must be subset of scale_items) |
two_items_reliability |
How should the reliability of two-item scales be reported? "spearman_brown" is the recommended default, but "cronbachs_alpha" and Pearson's "r" are also supported. |
r_key |
(optional) Numeric. Set to the possible maximum value of the scale if the whole scale should be reversed, or to -1 to reverse the scale based on the observed maximum. |
print_hist |
Logical. Should histograms for items and resulting scale be printed? |
print_desc |
Logical. Should descriptives for scales be printed? |
return_list |
Logical. Should only scale values be returned, or descriptives as well? |
Depends on return_list
argument. Either just the scale values,
or a list of scale values and descriptives.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.