make_scale: Creates a scale by calculating item mean and returns...

View source: R/make_scales.R

make_scaleR Documentation

Creates a scale by calculating item mean and returns descriptives

Description

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.

Usage

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
)

Arguments

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 are reversed.

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?

Value

Depends on return_list argument. Either just the scale values, or a list of scale values and descriptives.


LukasWallrich/rNuggets documentation built on Aug. 26, 2022, 11:03 a.m.