Did you create aggregates of items like this scale <- scale_1 + scale_2R + scale_3R? If you run this function on a dataset, it will detect these relationships and set the appropriate attributes. Once they are set, the codebook package can perform reliability computations for you.

detect_scales(data, quiet = FALSE)

Arguments

data

the data frame

quiet

defaults to false. Suppresses messages about found items.

Examples

bfi <- data.frame(matrix(data = rnorm(500), ncol = 5)) names(bfi) <- c("bfi_e1", "bfi_e2R", "bfi_e3", "bfi_n1", "bfi_n2") bfi$bfi_e <- rowMeans(bfi[, c("bfi_e1", "bfi_e2R", "bfi_e3")]) bfi <- detect_scales(bfi)
#> 3 bfi_e items connected to scale
#> Warning: bfi_n items found, but no aggregate
bfi$bfi_e
#> [1] 0.8015485778 0.1242008715 1.4111601036 -1.2359843828 0.8755174016 #> [6] 0.9704337425 0.1256702396 0.4579800147 0.1481186619 -0.2613590844 #> [11] -0.0454207511 1.2847818751 0.0969500761 -0.4646285832 0.9872776221 #> [16] 1.0607406147 0.8092427361 -0.3909060260 -0.1631451792 -0.0168259197 #> [21] 0.0379601509 -1.3348544542 -0.3418188349 -0.3469655384 0.2681050820 #> [26] 0.0160450021 0.6795888007 -0.6340680673 -0.9698365999 0.5346686176 #> [31] -1.1772199366 0.5013617944 0.7480301550 0.7210123466 -0.5085987698 #> [36] -0.7530780276 0.7376071929 0.7836556475 0.2392642892 0.9698502499 #> [41] 0.2076311038 0.4118653252 -0.0735040359 0.4506413326 0.2195415811 #> [46] 0.1802557582 -0.2274196804 0.0477936993 -0.8153949023 0.6790446071 #> [51] -1.0123051762 -0.1929429826 0.3603824703 -0.9452471654 -0.2475681063 #> [56] 0.7194436012 -0.2554316310 -0.4332763827 0.8590040320 0.9552586648 #> [61] 0.1924536606 -0.5312016165 1.4697668632 -0.3988861741 -0.0001894151 #> [66] -0.3956289014 0.8160424138 -0.3266707117 -0.1756387935 -0.6017318640 #> [71] 0.1412798858 1.3190123866 0.4557577536 -0.0185777490 0.3302301687 #> [76] -0.1244923341 0.4662560852 -0.6980709833 0.1884465481 0.1645677940 #> [81] 0.6181046675 -0.9340002428 -0.6359859871 -0.3176546090 -0.4788309317 #> [86] 0.2373336437 0.1946028667 0.0456007471 -1.2833583570 0.0641209995 #> [91] 0.0325788440 0.1460103547 1.3553405723 0.6966568876 -0.3455142832 #> [96] 0.1093705621 1.0434134739 0.1010924876 -0.8042213045 -0.4034993055 #> attr(,"scale_item_names") #> [1] "bfi_e1" "bfi_e2R" "bfi_e3" #> attr(,"label") #> [1] "aggregate of 3 bfi_e items"