tidy_stats.psych: tidy_stats method for psych's alpha objects

Description Usage Arguments Examples

View source: R/tidy_stats.psych.R

Description

Creates a tidystats data frame for a psych's alpha object.

Usage

1
2
## S3 method for class 'psych'
tidy_stats(model, args = NULL)

Arguments

model

An psych alpha object

args

Unused.

Examples

 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)
}

WillemSleegers/tidystats-v0.3 documentation built on Aug. 12, 2019, 5:31 p.m.