score_scale_items: Score scale items

View source: R/score_scale_items.R

score_scale_itemsR Documentation

Score scale items

Description

Score items in a scale (e.g., Likert scale items) by computing the sum or mean of the items.

Usage

score_scale_items(
  item_list = NULL,
  reverse_item_list = NULL,
  operation = "mean",
  na.rm = FALSE,
  na_summary = TRUE,
  reverse_code_minuend = NULL
)

Arguments

item_list

a list of scale items (i.e., list of vectors of ratings) to code normally (as opposed to reverse coding).

reverse_item_list

a list of scale items to reverse code.

operation

if operation = "mean", mean of the scale items will be calculated; if operation = "sum", sum of the scale items will be calculated (default = "mean").

na.rm

logical. The na.rm argument that will be passed onto the base R's rowMeans or rowSums function (default = FALSE).

na_summary

logical. If na_summary = TRUE a summary of NA values will be printed; if na_summary = FALSE the summary will not be printed (default = TRUE).

reverse_code_minuend

required for reverse coding; the number from which to subtract item ratings when reverse-coding. For example, if the items to reverse code are measured on a 7-point scale, enter reverse_code_minuend = 8.

Examples

score_scale_items(item_list = list(1:5, rep(3, 5)),
reverse_item_list = list(rep(5, 5)), reverse_code_minuend = 6)
score_scale_items(item_list = list(c(1, 1), c(1, 5)),
reverse_item_list = list(c(5, 3)),
reverse_code_minuend = 6, na_summary = FALSE)
score_scale_items(item_list = list(c(1, 1), c(1, 5)),
reverse_item_list = list(c(5, 1)),
reverse_code_minuend = 6, operation = "sum")
score_scale_items(item_list = list(1:5, rep(3, 5)))
score_scale_items(item_list = list(c(1, NA, 3), c(NA, 2, 3)))
score_scale_items(item_list = list(c(1, NA, 3), c(NA, 2, 3)), na.rm = TRUE)

kim documentation built on Oct. 9, 2023, 5:08 p.m.