View source: R/syntax-create_scales.R
create_scales | R Documentation |
This function calculates mean or sum scores from a
data.frame
and a named list describing the items in each scale. It
returns the scores, a scale descriptive table, and a scale correlation table.
It relies on several functions from the
psych
package.
create_scales(
x,
keys.list,
missing = TRUE,
impute = "none",
omega = NULL,
digits = 2,
...
)
## S3 method for class 'tidy_sem'
create_scales(
x,
keys.list,
missing = TRUE,
impute = "none",
omega = NULL,
digits = 2,
...
)
x |
A |
keys.list |
A named list, indicating which variables belong to which scale. |
missing |
Whether to use rows with partially missing values. Default: TRUE. |
impute |
Method for handling missing values, Default: 'none'. This default method uses all available data to calculate scale scores, which is acceptable for mean scales, but not for sum scales. |
omega |
Which of McDonald's |
digits |
Number of digits for rounding, Default: 2 |
... |
Additional parameters to pass to and from functions. |
For scales with less than 3 items, Cronbach's alpha might not be suitable as an estimate of reliability. For such scales, the Spearman-Brown reliability coefficient for two-item scales is computed, as described in Eisinga, R., Grotenhuis, M. te, & Pelzer, B. (2012). The reliability of a two-item scale: Pearson, Cronbach, or Spearman-Brown? International Journal of Public Health, 58(4), 637–642. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s00038-012-0416-3")}. These coefficients are marked with "(sb)".
List with elements: $descriptives
, $correlations
, and
$scores
.
out <- create_scales(iris, keys.list = list(scalename =
c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")))
out$descriptives
dict <- tidy_sem(iris, split = "\\.")
create_scales(dict)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.