Description Usage Arguments Examples
View source: R/tidy_stats.psych.R
Creates a tidystats data frame for a psych's alpha object.
1 2 | ## S3 method for class 'psych'
tidy_stats(model, args = NULL)
|
model |
An psych alpha object |
args |
Unused. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Check if psych and dplyr packages are available
if(!requireNamespace("psych", quietly = TRUE)) {
message(paste0("Package 'psych' is needed for this example to work. ",
"Please install it."), .call = FALSE)
} else {
# Create an empty list to store results in
results <- list()
# Example: Cronbach's alpha
alpha_agreeableness <- psych::bfi %>%
dplyr::select(A1, A2, A3, A4, A5) %>%
psych::alpha(check.keys = TRUE, warnings = FALSE)
# Tidy stats
tidy_stats(alpha_agreeableness)
# Example: Correlations
cors_agreeableness <- psych::bfi %>%
dplyr::select(A1, A2, A3, A4, A5) %>%
psych::corr.test()
# Tidy stats
tidy_stats(cors_agreeableness)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.