This function creates multiple scales, returns descriptives and supports reverse-coding of items.

make_scales(
  data,
  items,
  reversed = FALSE,
  two_items_reliability = c("spearman_brown", "cronbachs_alpha", "r"),
  print_desc = FALSE,
  ...
)

Arguments

data

A dataframe

items

A named list of characters vectors. Names are the scale names, each vector contains the items for that scale (variables in data)

reversed

How should items be reverse-coded. Can be FALSE (no reverse-coding), TRUE (automatic reverse-coding of items negatively correlated with remainder), or a named list of characters vectors. Names are the scale names, each vector contains the items to be reverse-coded for that scale. If TRUE, the result must be checked carefully!

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.

print_desc

Logical. Should descriptives for scales be printed?

...

Arguments passed on to make_scale

print_hist

Logical. Should histograms for items and resulting scale be printed?

Value

A list of two dataframes: scale values (scores) and descriptive statistics for each scale (descriptives)