## Define function that recodes to numeric, but watches out to coercion to not introduce NAs
colstonumeric <- function(df){
tryCatch({
df_num <- as.data.frame(
lapply(df,
function(x) { as.numeric(as.character(x))}))
},warning = function(stop_on_warning) {
message("Stoped the execution of numeric conversion: ", conditionMessage(stop_on_warning))
})
}
##
## Define function that reverse codes items
ReverseCode <- function(df, tonumeric = FALSE, min = NULL, max = NULL) {
if(tonumeric) df <- colstonumeric(df)
df <- (max + min) - df
}
##
# Scores
## Define function that scores only rows with less than 10% NAs (returns NA if all or above threshold percentage of rows are NA); can reverse code if vector of column indexes and min, max are provided.
ScoreLikert <- function(df, stat = c("sum", "mean"), imputena = c(FALSE, "zero", "mean", "median"),
napercent = .1, tonumeric = FALSE, reversecols = NULL, min = NULL, max = NULL) {
stat <- match.arg(stat)
imputena <- match.arg(imputena)
reverse_list <- list(reversecols = reversecols, min = min, max = max)
reverse_check <- !sapply(reverse_list, is.null)
# Recode to numeric, but watch out to coercion to not introduce NAs
colstonumeric <- function(df){
tryCatch({
df_num <- as.data.frame(
lapply(df,
function(x) { as.numeric(as.character(x))}))
},warning = function(stop_on_warning) {
message("Stoped the execution of numeric conversion: ", conditionMessage(stop_on_warning))
})
}
if(tonumeric) df <- colstonumeric(df)
if(all(reverse_check)){
df[ ,reversecols] <- (max + min) - df[ ,reversecols]
}else if(any(reverse_check)){
stop("Insuficient info for reversing. Please provide: ", paste(names(reverse_list)[!reverse_check], collapse = ", "))
}
if(tonumeric) df <- colstonumeric(df)
if(imputena == "zero") df[is.na(df)] <- 0 # NAs to 0 can help when stat = "mean" with na.rm = T because it keeps denominator constant
if(imputena == "mean") { # replace NA with row means, the denominator of this mean is the number of completed items
# index_na <- which(is.na(df), arr.ind = TRUE) # for some reason doesnt work on tibbles
# df[index_na] <- rowMeans(df, na.rm=TRUE)[index_na[, 1]]
df <- t(apply(df, 1, function(x) replace(x, is.na(x), mean(x, na.rm = TRUE))))
}
if(imputena == "median") { # replace NA with row medians
df <- t(apply(df, 1, function(x) replace(x, is.na(x), median(x, na.rm = TRUE))))
}
if(stat == "sum"){
df_res <- ifelse(rowSums(is.na(df)) > ncol(df) * napercent,
NA,
rowSums(df, na.rm = TRUE) * NA ^ (rowSums(!is.na(df)) == 0))
}
if(stat == "mean"){
df_res <- ifelse(rowSums(is.na(df)) > ncol(df) * napercent,
NA,
rowMeans(df, na.rm = TRUE) * NA ^ (rowSums(!is.na(df)) == 0))
}
return(df_res)
}
##
# Tests --- Don't Run
# bla <- mtcars[, 8:11]
#
# bla[1, 4] <- NA
# bla[2, 3] <- NA; bla[2, 4] <- NA
# bla[3, 2] <- NA; bla[3, 3] <- NA; bla[3, 4] <- NA
#
# bla$Tot <- ScoreLikert(bla[, 1:4])
# bla$Tot2 <- ScoreLikert(bla[, 1:4], napercent = .9)
# bla$Tot3 <- ScoreLikert(bla[, 1:4], imputena = "zero", napercent = .1)
# bla$Tot4 <- ScoreLikert(bla[, 1:4], stat = "mean", imputena = "zero", napercent = .1)
# bla$Tot5 <- ScoreLikert(bla[, 1:4], stat = "sum", imputena = "zero", napercent = .1)
# bla$Tot6 <- ScoreLikert(bla[, 1:4], stat = "sum", imputena = "mean", napercent = .9)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Read, Clean, Recode, Unite
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## Read files
folder <- "C:/Users/Mihai/Desktop/R Notebooks/notebooks/municipal-covid"
file <- "Cercetare SUUB - Covid 2020.xlsx"
setwd(folder)
# Read data
Data <- rio::import(file.path(folder, file),
skip = 0, which = "Sheet2")
# Exclude last 3 rows: empty and other info
Data <- Data[-c(133:135),]
## Cutoffs
cutoffPCL <- 32 # literature: 31-33 or 38
algPCL <- data.frame(B = 1, C = 1, D = 2, E = 2)
cutoffMBI_Ex <- 2.20
cutoffMBI_Cy <- 2
##
# Define column index: index = col index; itemindex = index of item in questionnaire
indexDASS <- 22:42
indexMBI <- 43:58
indexCERQ <- 59:94
indexPCL <- 95:114
itemindexMBI_Ex <- c(1, 3, 5, 11, 14) # Emotional Exhaustion
itemindexMBI_Cy <- c(2, 7, 8, 13, 15) # Cynicism
itemindexMBI_Pe <- c(4, 6, 9, 10, 12, 16) # Professional Efficacy
itemindexDASS_S <- c(1, 6, 8, 11, 12, 14, 18)
itemindexDASS_D <- c(3, 5, 10, 13, 16, 17, 21)
itemindexDASS_A <- c(2, 4, 7, 9, 15, 19, 20)
itemindexCERQ_Sbl <- c(1, 10, 19, 28) # Self-blame
itemindexCERQ_Acc <- c(2, 11, 20, 29) # Acceptance
itemindexCERQ_Rum <- c(3, 12, 21, 30) # Rumination
itemindexCERQ_PRf <- c(4, 13, 22, 31) # Positive Refocusing
itemindexCERQ_RPl <- c(5, 14, 23, 32) # Refocus on Planning
itemindexCERQ_PRa <- c(6, 15, 24, 33) # Positive Reappraisal
itemindexCERQ_PPe <- c(7, 16, 25, 34) # Putting into Perspective
itemindexCERQ_Cat <- c(8, 17, 26, 35) # Catastrophizing
itemindexCERQ_Obl <- c(9, 18, 27, 36) # Other-blame
# Rename columns
# names(Data)[1:12] <- stringr::str_replace_all(names(Data)[1:12], "[[:blank:]]", "_")
Data <- janitor::clean_names(Data)
names(Data)[1] <- "ID"
names(Data)[names(Data) %in% names(Data[, indexDASS])] <- c(sprintf("DASS_%01d", seq(1, 21)))
names(Data)[names(Data) %in% names(Data[, indexMBI])] <- c(sprintf("MBI_%01d", seq(1, 16)))
names(Data)[names(Data) %in% names(Data[, indexCERQ])] <- c(sprintf("CERQ_%01d", seq(1, 36)))
names(Data)[names(Data) %in% names(Data[, indexPCL])] <- c(sprintf("PCL_%01d", seq(1, 20)))
# Transform general info
to_num_cols <- c(2, 5, 6) # "varsta", "copii", "nepoti"
to_fac_cols <- c(3, 4, 7:21)
Data <-
Data %>%
dplyr::mutate_at(vars(to_num_cols), as.numeric) %>%
dplyr::mutate_at(vars(to_fac_cols), as.factor)
# Transfomr item scores to numeric
Data[, indexDASS] <- colstonumeric(Data[, indexDASS])
Data[, indexMBI] <- colstonumeric(Data[, indexMBI])
Data[, indexCERQ] <- colstonumeric(Data[, indexCERQ])
Data[, indexPCL] <- colstonumeric(Data[, indexPCL])
# Score CERQ
Data$CERQ_Sbl <- ScoreLikert(Data[, c(sprintf("CERQ_%01d", itemindexCERQ_Sbl))], stat = "sum", imputena = "mean", napercent = 1)
Data$CERQ_Acc <- ScoreLikert(Data[, c(sprintf("CERQ_%01d", itemindexCERQ_Acc))], stat = "sum", imputena = "mean", napercent = 1)
Data$CERQ_Rum <- ScoreLikert(Data[, c(sprintf("CERQ_%01d", itemindexCERQ_Rum))], stat = "sum", imputena = "mean", napercent = 1)
Data$CERQ_PRf <- ScoreLikert(Data[, c(sprintf("CERQ_%01d", itemindexCERQ_PRf))], stat = "sum", imputena = "mean", napercent = 1)
Data$CERQ_RPl <- ScoreLikert(Data[, c(sprintf("CERQ_%01d", itemindexCERQ_RPl))], stat = "sum", imputena = "mean", napercent = 1)
Data$CERQ_PRa <- ScoreLikert(Data[, c(sprintf("CERQ_%01d", itemindexCERQ_PRa))], stat = "sum", imputena = "mean", napercent = 1)
Data$CERQ_PPe <- ScoreLikert(Data[, c(sprintf("CERQ_%01d", itemindexCERQ_PPe))], stat = "sum", imputena = "mean", napercent = 1)
Data$CERQ_Cat <- ScoreLikert(Data[, c(sprintf("CERQ_%01d", itemindexCERQ_PPe))], stat = "sum", imputena = "mean", napercent = 1)
# Score DASS
Data$DASS_S <- ScoreLikert(Data[, c(sprintf("DASS_%01d", itemindexDASS_S))], napercent = 1)
Data$DASS_D <- ScoreLikert(Data[, c(sprintf("DASS_%01d", itemindexDASS_D))], napercent = 1)
Data$DASS_A <- ScoreLikert(Data[, c(sprintf("DASS_%01d", itemindexDASS_A))], napercent = 1)
# Correct MBI error (MBI items scores are 0-6, while in data item scores range 0-7)
Data[, indexMBI] <-
Data[, indexMBI] %>%
dplyr::mutate_all(~ifelse(. == 7, 6, .))
# Score MBI
Data$MBI_Total <- ScoreLikert(Data[, indexMBI], napercent = .3, stat = "mean", imputena = "zero")
Data$MBI_Ex <- ScoreLikert(Data[, c(sprintf("MBI_%01d", itemindexMBI_Ex))], napercent = 1, stat = "mean", imputena = "zero")
Data$MBI_Cy <- ScoreLikert(Data[, c(sprintf("MBI_%01d", itemindexMBI_Cy))], napercent = 1, stat = "mean", imputena = "zero")
Data$MBI_Pe <- ScoreLikert(Data[, c(sprintf("MBI_%01d", itemindexMBI_Pe))], napercent = 1, stat = "mean", imputena = "zero")
# Score PCL
Data$PCL_Total <- ScoreLikert(Data[, indexPCL], napercent = .3) # NA if NA threshold is exceeded
Data$PCL_B <- ScoreLikert(Data[, c(sprintf("PCL_%01d", 1:5))], napercent = 1) # do nothing if NA threshold is exceeded
Data$PCL_C <- ScoreLikert(Data[, c(sprintf("PCL_%01d", 6:7))], napercent = 1)
Data$PCL_D <- ScoreLikert(Data[, c(sprintf("PCL_%01d", 8:14))], napercent = 1)
Data$PCL_E <- ScoreLikert(Data[, c(sprintf("PCL_%01d", 15:20))], napercent = 1)
# ---
# PCL Diagnostic Algorithm
itemsPCL_B <- c(sprintf("PCL_%01d", 1:5))
itemsPCL_C <- c(sprintf("PCL_%01d", 6:7))
itemsPCL_D <- c(sprintf("PCL_%01d", 8:14))
itemsPCL_E <- c(sprintf("PCL_%01d", 15:20))
DataPCLAlg <-
Data %>%
dplyr::select(tidyselect::all_of(indexPCL)) %>%
dplyr::mutate_all(
funs(case_when(
. >=2 ~ 1,
# . <2 ~ 0,
is.na(.) ~ 0,
TRUE ~ 0))) %>%
mutate(PCL_CritB = case_when(rowSums(.[,itemsPCL_B], na.rm = TRUE) >= algPCL$B ~ 1, # algPCL <- data.frame(B = 1, C = 1, D = 2, E = 2)
# rowSums(.[,itemsPCL_B], na.rm = TRUE) <1 ~ 0,
TRUE ~ 0)) %>%
mutate(PCL_CritC = case_when(rowSums(.[,itemsPCL_C], na.rm = TRUE) >= algPCL$C ~ 1,
# rowSums(.[,itemsPCL_C], na.rm = TRUE) <1 ~ 0,
TRUE ~ 0)) %>%
mutate(PCL_CritD = case_when(rowSums(.[,itemsPCL_D], na.rm = TRUE) >= algPCL$D ~ 1,
# rowSums(.[,itemsPCL_D], na.rm = TRUE) <1 ~ 0,
TRUE ~ 0)) %>%
mutate(PCL_CritE = case_when(rowSums(.[,itemsPCL_E], na.rm = TRUE) >= algPCL$E ~ 1,
# rowSums(.[,itemsPCL_E], na.rm = TRUE) <1 ~ 0,
TRUE ~ 0)) %>%
mutate(PCL_Alg = case_when(PCL_CritB == 1 & PCL_CritC == 1 & PCL_CritD == 1 & PCL_CritE == 1 ~ 1,
TRUE ~ 0))
# Cutoffs
Data$PCL_cut <- ifelse(Data$PCL_Total >= cutoffPCL, 1, 0)
Data$PCLAlg <- DataPCLAlg$PCL_Alg
Data$MBI_Ex_cut <- ifelse(Data$MBI_Ex >= cutoffMBI_Ex, 1, 0)
Data$MBI_Cy_cut <- ifelse(Data$MBI_Cy >= cutoffMBI_Cy, 1, 0)
Data$MBI_cut <- ifelse(Data$MBI_Ex_cut | Data$MBI_Cy_cut, 1, 0)
# ---
# knitr::asis_output("## Basic description for dataframe")
Data[, -indexAllItems] %>%
dplyr::rename_all(~stringr::str_replace_all( ., "_", " " )) %>%
dplyr::rename_all(~stringr::str_wrap(., 20)) %>%
summarytools::dfSummary(plain.ascii = FALSE, style = "grid",
graph.magnif = 0.75, valid.col = FALSE) %>%
print(method = 'render')
No | Variable | Stats / Values | Freqs (% of Valid) | Graph | Missing |
---|---|---|---|---|---|
1 | ID [numeric] | mean (sd) : 66.5 (38.25) min < med < max : 1 < 66.5 < 132 IQR (CV) : 65.5 (0.58) | 132 distinct values | 0 (0%) | |
2 | varsta [numeric] | mean (sd) : 2.83 (1.05) min < med < max : 1 < 3 < 5 IQR (CV) : 1.5 (0.37) | 1 : 18 (13.7%) 2 : 25 (19.1%) 3 : 55 (42.0%) 4 : 27 (20.6%) 5 : 6 (4.6%) | 1 (0.76%) | |
3 | gen [factor] | 1. 1 2. 2 | 16 (12.1%) 116 (87.9%) | 0 (0%) | |
4 | status marital [factor] | 1. 0 2. 1 3. 2 4. 3 5. 4 | 1 (0.8%) 39 (29.5%) 74 (56.1%) 16 (12.1%) 2 (1.5%) | 0 (0%) | |
5 | copii [numeric] | mean (sd) : 0.88 (0.86) min < med < max : 0 < 1 < 4 IQR (CV) : 1 (0.98) | 0 : 49 (37.4%) 1 : 55 (42.0%) 2 : 23 (17.6%) 3 : 2 (1.5%) 4 : 2 (1.5%) | 1 (0.76%) | |
6 | nepoti [numeric] | mean (sd) : 0.41 (1.02) min < med < max : 0 < 0 < 6 IQR (CV) : 0 (2.48) | 0 : 104 (79.4%) 1 : 14 (10.7%) 2 : 7 (5.3%) 4 : 5 (3.8%) 6 : 1 (0.8%) | 1 (0.76%) | |
7 | domiciliu [factor] | 1. 0 2. 1 3. 2 4. 3 | 1 (0.8%) 109 (82.6%) 5 (3.8%) 17 (12.9%) | 0 (0%) | |
8 | scoala absolvita [factor] | 1. 1 2. 2 3. 3 | 1 (0.8%) 63 (47.7%) 68 (51.5%) | 0 (0%) | |
9 | ani de lucru in domeniu [factor] | 1. 1 2. 2 3. 3 4. 4 5. 5 | 25 (19.1%) 24 (18.3%) 13 (9.9%) 22 (16.8%) 47 (35.9%) | 1 (0.76%) | |
10 | profesie ocupatie [factor] | 1. 1 2. 2 3. 3 4. 4 5. 5 | 22 (16.8%) 92 (70.2%) 11 (8.4%) 2 (1.5%) 4 (3.0%) | 1 (0.76%) | |
11 | sectia pe care desfasurati activitatea [factor] | 1. 1 2. 12 3. 14 4. 16 5. 18 6. 2 7. 20 8. 21 9. 3 10. 4 [ 4 others ] | 32 (24.2%) 5 (3.8%) 1 (0.8%) 9 (6.8%) 8 (6.1%) 13 (9.8%) 3 (2.3%) 23 (17.4%) 4 (3.0%) 3 (2.3%) 31 (23.5%) | 0 (0%) | |
12 | pe sectia pe care lucrati au fost de la inceputul pandemiei cu covid 19 depistate cazuri pozitive [factor] | 1. 1 2. 2 | 117 (89.3%) 14 (10.7%) | 1 (0.76%) | |
13 | care a fost programul de lucru in timpul starii de urgenta [factor] | 1. 1 2. 2 3. 7 | 16 (12.2%) 114 (87.0%) 1 (0.8%) | 1 (0.76%) | |
14 | care a fost numarul de garzi in timpul starii de urgenta [factor] | 1. 1 2. 2 3. 3 4. 4 5. 5 6. 6 | 2 (1.5%) 1 (0.8%) 5 (3.8%) 9 (6.9%) 57 (43.5%) 57 (43.5%) | 1 (0.76%) | |
15 | ati fost testat a pentru sars cov 2 in aceasta perioada de la inceputul pamdemiei [factor] | 1. 1 2. 2 | 123 (93.9%) 8 (6.1%) | 1 (0.76%) | |
16 | daca da de cate ori [factor] | 1. 1 2. 2 3. 3 4. 4 5. 5 6. 6 | 58 (44.3%) 39 (29.8%) 16 (12.2%) 9 (6.9%) 7 (5.3%) 2 (1.5%) | 1 (0.76%) | |
17 | in conditiile in care ati fost testat a cate zile ati asteptat rezultatul testului [factor] | 1. 1 2. 2 3. 3 4. 4 | 103 (78.6%) 15 (11.5%) 3 (2.3%) 10 (7.6%) | 1 (0.76%) | |
18 | daca da care a fost rezultatul [factor] | 1. 1 2. 2 3. 3 | 24 (18.3%) 99 (75.6%) 8 (6.1%) | 1 (0.76%) | |
19 | in urma rezultatului pozitiv al testului ati stat [factor] | 1. 2 2. 3 3. 4 4. 5 | 2 (1.5%) 16 (12.2%) 112 (85.5%) 1 (0.8%) | 1 (0.76%) | |
20 | desi nu ati fost depistat pozitiv dar ati avut contact cu colegi pacienti care au fost depistati pozitiv cu sars cov 2 unde ati stat in izolare [factor] | 1. 1 2. 2 3. 3 4. 4 5. 5 | 19 (14.5%) 27 (20.6%) 3 (2.3%) 1 (0.8%) 81 (61.8%) | 1 (0.76%) | |
21 | pe o scala de la 1 la 10 dati o nota pentru cat de daunator sanatatii dvs considerati ca ar putea fi virusul sars cov 2 [factor] | 1. 1 2. 10 3. 11 4. 2 5. 3 6. 4 7. 5 8. 6 9. 7 10. 8 [ 1 others ] | 10 (7.6%) 44 (33.6%) 2 (1.5%) 2 (1.5%) 3 (2.3%) 4 (3.1%) 12 (9.2%) 8 (6.1%) 14 (10.7%) 18 (13.7%) 14 (10.7%) | 1 (0.76%) | |
22 | CERQ Sbl [numeric] | mean (sd) : 8.27 (3.44) min < med < max : 3 < 8 < 20 IQR (CV) : 5 (0.42) | 17 distinct values | 0 (0%) | |
23 | CERQ Acc [numeric] | mean (sd) : 11.16 (4.04) min < med < max : 4 < 10 < 20 IQR (CV) : 6 (0.36) | 16 distinct values | 0 (0%) | |
24 | CERQ Rum [numeric] | mean (sd) : 11.48 (4.09) min < med < max : 4 < 11 < 20 IQR (CV) : 5 (0.36) | 17 distinct values | 0 (0%) | |
25 | CERQ PRf [numeric] | mean (sd) : 12.78 (4.59) min < med < max : 4 < 12 < 20 IQR (CV) : 8 (0.36) | 17 distinct values | 0 (0%) | |
26 | CERQ RPl [numeric] | mean (sd) : 15.1 (4.03) min < med < max : 4 < 16 < 20 IQR (CV) : 6.25 (0.27) | 17 distinct values | 0 (0%) | |
27 | CERQ PRa [numeric] | mean (sd) : 15.46 (3.82) min < med < max : 4 < 16 < 20 IQR (CV) : 4 (0.25) | 16 distinct values | 0 (0%) | |
28 | CERQ PPe [numeric] | mean (sd) : 13.9 (4) min < med < max : 4 < 14 < 20 IQR (CV) : 6 (0.29) | 16 distinct values | 0 (0%) | |
29 | CERQ Cat [numeric] | mean (sd) : 13.9 (4) min < med < max : 4 < 14 < 20 IQR (CV) : 6 (0.29) | 16 distinct values | 0 (0%) | |
30 | DASS S [numeric] | mean (sd) : 4.94 (4.25) min < med < max : 0 < 4 < 17 IQR (CV) : 5 (0.86) | 16 distinct values | 0 (0%) | |
31 | DASS D [numeric] | mean (sd) : 3.12 (3.64) min < med < max : 0 < 2 < 17 IQR (CV) : 5 (1.17) | 14 distinct values | 0 (0%) | |
32 | DASS A [numeric] | mean (sd) : 3.05 (3.97) min < med < max : 0 < 1 < 20 IQR (CV) : 5 (1.3) | 17 distinct values | 0 (0%) | |
33 | MBI Total [numeric] | mean (sd) : 1.36 (1.17) min < med < max : 0 < 0.97 < 4.94 IQR (CV) : 1.58 (0.86) | 53 distinct values | 0 (0%) | |
34 | MBI Ex [numeric] | mean (sd) : 2.14 (1.6) min < med < max : 0 < 1.8 < 6 IQR (CV) : 2.6 (0.75) | 31 distinct values | 0 (0%) | |
35 | MBI Cy [numeric] | mean (sd) : 1.27 (1.33) min < med < max : 0 < 1 < 6 IQR (CV) : 1.45 (1.05) | 24 distinct values | 0 (0%) | |
36 | MBI Pe [numeric] | mean (sd) : 0.8 (1.16) min < med < max : 0 < 0.17 < 5 IQR (CV) : 1 (1.46) | 24 distinct values | 0 (0%) | |
37 | PCL Total [numeric] | mean (sd) : 15.95 (13.63) min < med < max : 0 < 11.5 < 63 IQR (CV) : 19 (0.85) | 41 distinct values | 0 (0%) | |
38 | PCL B [numeric] | mean (sd) : 4.38 (4.35) min < med < max : 0 < 3 < 16 IQR (CV) : 5 (0.99) | 17 distinct values | 0 (0%) | |
39 | PCL C [numeric] | mean (sd) : 1.95 (2.23) min < med < max : 0 < 1 < 8 IQR (CV) : 3 (1.14) | 0 : 48 (36.4%) 1 : 25 (18.9%) 2 : 18 (13.6%) 3 : 11 (8.3%) 4 : 11 (8.3%) 5 : 6 (4.5%) 6 : 6 (4.5%) 7 : 2 (1.5%) 8 : 5 (3.8%) | 0 (0%) | |
40 | PCL D [numeric] | mean (sd) : 4.33 (5.12) min < med < max : 0 < 2 < 22 IQR (CV) : 7 (1.18) | 19 distinct values | 0 (0%) | |
41 | PCL E [numeric] | mean (sd) : 5.29 (4.21) min < med < max : 0 < 4 < 17 IQR (CV) : 5.25 (0.8) | 18 distinct values | 0 (0%) | |
42 | PCL cut [numeric] | mean (sd) : 0.12 (0.33) min < med < max : 0 < 0 < 1 IQR (CV) : 0 (2.7) | 0 : 116 (87.9%) 1 : 16 (12.1%) | 0 (0%) | |
43 | PCLAlg [numeric] | mean (sd) : 0.14 (0.34) min < med < max : 0 < 0 < 1 IQR (CV) : 0 (2.53) | 0 : 114 (86.4%) 1 : 18 (13.6%) | 0 (0%) | |
44 | MBI Ex cut [numeric] | mean (sd) : 0.45 (0.5) min < med < max : 0 < 0 < 1 IQR (CV) : 1 (1.1) | 0 : 72 (54.5%) 1 : 60 (45.5%) | 0 (0%) | |
45 | MBI Cy cut [numeric] | mean (sd) : 0.22 (0.42) min < med < max : 0 < 0 < 1 IQR (CV) : 0 (1.89) | 0 : 103 (78.0%) 1 : 29 (22.0%) | 0 (0%) | |
46 | MBI cut [numeric] | mean (sd) : 0.48 (0.5) min < med < max : 0 < 0 < 1 IQR (CV) : 1 (1.03) | 0 : 68 (51.5%) 1 : 64 (48.5%) | 0 (0%) |
Generated by summarytools 0.8.8 (R version 3.6.1)
2021-03-19
# knitr::asis_output("## Frequency distribution of all discrete variables by PCL cutoff")
# plot_bar(Data, by = "PCL_cut")
#
# knitr::asis_output("## Frequency distribution of all discrete variables by PCL diagnostic alg")
# plot_bar(Data, by = "PCLAlg")
#
# knitr::asis_output("## Frequency distribution of all discrete variables by MBI cutoff")
# plot_bar(Data, by = "MBI_cut")
Data %>%
dplyr::select(-all_of(c(indexDASS, indexMBI, indexCERQ, indexPCL))) %>% # exclude items
plot_histogram()
ggstatsplot::ggbetweenstats(
data = Data,
x = cazuri_pe_sectie, y = MBI_Total,
type = "nonparametric",
title = "Burnout Total")
ggstatsplot::ggbetweenstats(
data = Data,
x = cazuri_pe_sectie, y = PCL_Total,
type = "nonparametric",
title = "PTSD Total")
ggstatsplot::ggbetweenstats(
data = Data,
x = cazuri_pe_sectie, y = DASS_A,
type = "nonparametric",
title = "Anxiety")
ggstatsplot::ggbetweenstats(
data = Data,
x = expunere, y = MBI_Total,
type = "nonparametric",
title = "Burnout Total")
ggstatsplot::ggbetweenstats(
data = Data,
x = expunere, y = PCL_Total,
type = "nonparametric",
title = "PTSD Total")
ggstatsplot::ggbetweenstats(
data = Data,
x = expunere, y = DASS_A,
type = "nonparametric",
title = "Anxiety")
ggstatsplot::ggbetweenstats(
data = Data,
x = sectie_categ, y = MBI_Total,
type = "nonparametric",
title = "Burnout Total")
ggstatsplot::ggbetweenstats(
data = Data,
x = sectie_categ, y = PCL_Total,
type = "nonparametric",
title = "PTSD Total")
ggstatsplot::ggbetweenstats(
data = Data,
x = sectie_categ, y = DASS_A,
type = "nonparametric",
title = "Anxiety")
ggstatsplot::ggpiestats(
data = Data,
x = sectie_categ, y = PCLAlg,
type = "nonparametric",
title = "PTSD algo")
ggstatsplot::ggpiestats(
data = Data,
x = sectie_categ, y = PCL_cut,
type = "nonparametric",
title = "PTSD cutoff")
ggstatsplot::ggpiestats(
data = Data,
x = sectie_categ, y = MBI_cut,
type = "nonparametric",
title = "MBI cutoff")
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
Matrix products: default
locale:
[1] LC_COLLATE=Romanian_Romania.1250 LC_CTYPE=Romanian_Romania.1250 LC_MONETARY=Romanian_Romania.1250 LC_NUMERIC=C
[5] LC_TIME=Romanian_Romania.1250
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dlookr_0.4.3 statsExpressions_1.0.0 ggstatsplot_0.7.1 DataExplorer_0.8.2 performance_0.7.0 rlang_0.4.10
[7] pwr_1.2-2 emmeans_1.5.4 broom_0.7.5 rstatix_0.7.0 rio_0.5.26 scales_1.1.1
[13] ggpubr_0.4.0 tadaatoolbox_0.16.1 summarytools_0.8.8 PerformanceAnalytics_1.5.2 xts_0.11-2 zoo_1.8-4
[19] psych_2.0.12 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.5 purrr_0.3.4 readr_1.4.0
[25] tidyr_1.1.3 tibble_3.1.0 ggplot2_3.3.3 tidyverse_1.3.0 papaja_0.1.0.9997 pacman_0.5.1
loaded via a namespace (and not attached):
[1] estimability_1.3 coda_0.19-2 acepack_1.4.1 knitr_1.31 multcomp_1.4-8 data.table_1.14.0
[7] rpart_4.1-15 RCurl_1.95-4.11 generics_0.1.0 TH.data_1.0-9 correlation_0.6.0 webshot_0.5.1
[13] xml2_1.3.2 lubridate_1.7.4 httpuv_1.5.5 assertthat_0.2.1 viridis_0.5.1 WRS2_1.1-1
[19] xfun_0.22 hms_1.0.0 evaluate_0.14 promises_1.2.0.1 fansi_0.4.2 dbplyr_2.1.0
[25] readxl_1.3.1 igraph_1.2.6 DBI_1.0.0 tmvnsim_1.0-2 htmlwidgets_1.5.3 reshape_0.8.8
[31] kSamples_1.2-9 Rmpfr_0.7-1 paletteer_1.3.0 ellipsis_0.3.1 corrplot_0.84 backports_1.2.1
[37] insight_0.13.1 ggcorrplot_0.1.3 prismatic_1.0.0 rapportools_1.0 libcoin_1.0-2 vctrs_0.3.6
[43] prettydoc_0.4.1 abind_1.4-5 withr_2.4.1 pryr_0.1.4 RcmdrMisc_2.5-1 checkmate_1.8.5
[49] mnormt_2.0.2 svglite_1.2.1 cluster_2.1.1 crayon_1.4.1 pkgconfig_2.0.3 SuppDists_1.1-9.4
[55] labeling_0.4.2 nlme_3.1-140 nnet_7.3-12 lifecycle_1.0.0 miniUI_0.1.1.1 MatrixModels_0.4-1
[61] sandwich_2.5-0 extrafontdb_1.0 modelr_0.1.8 cellranger_1.1.0 matrixStats_0.54.0 partykit_1.2-13
[67] Matrix_1.2-17 mc2d_0.1-18 carData_3.0-2 boot_1.3-22 reprex_1.0.0 base64enc_0.1-3
[73] viridisLite_0.3.0 PMCMRplus_1.9.0 parameters_0.12.0 rootSolve_1.8.2.1 bitops_1.0-6 pander_0.6.3
[79] ggExtra_0.8 multcompView_0.1-7 ggsignif_0.6.1 memoise_1.1.0 magrittr_2.0.1 plyr_1.8.6
[85] compiler_3.6.1 rstantools_2.1.1 kableExtra_1.3.4 RColorBrewer_1.1-2 snakecase_0.9.2 cli_2.3.1
[91] patchwork_1.1.1 pbapply_1.3-4 htmlTable_1.12 Formula_1.2-3 MASS_7.3-51.4 tidyselect_1.1.0
[97] stringi_1.5.3 pixiedust_0.9.1 yaml_2.2.1 latticeExtra_0.6-28 ggrepel_0.9.1 grid_3.6.1
[103] tools_3.6.1 lmom_2.8 parallel_3.6.1 rstudioapi_0.13 foreign_0.8-71 inum_1.0-0
[109] janitor_2.1.0 gridExtra_2.3 ipmisc_6.0.0 gld_2.6.2 pairwiseComparisons_3.1.3 farver_2.1.0
[115] digest_0.6.27 shiny_1.2.0 nortest_1.0-4 quadprog_1.5-5 networkD3_0.4 BWStest_0.2.2
[121] Rcpp_1.0.6 car_3.0-10 BayesFactor_0.9.12-4.2 later_1.1.0.1 httr_1.4.2 gdtools_0.1.7
[127] effectsize_0.4.4 colorspace_2.0-0 rvest_1.0.0 fs_1.5.0 splines_3.6.1 rematch2_2.1.2
[133] expm_0.999-3 Exact_2.1 xtable_1.8-4 gmp_0.5-13.2 jsonlite_1.7.2 zeallot_0.1.0
[139] R6_2.5.0 Hmisc_4.1-1 pillar_1.5.1 htmltools_0.5.1.1 mime_0.10 glue_1.4.2
[145] class_7.3-15 codetools_0.2-16 mvtnorm_1.1-1 utf8_1.2.1 lattice_0.20-38 hrbrthemes_0.8.0
[151] curl_4.3 DescTools_0.99.40 gtools_3.8.1 zip_1.0.0 openxlsx_4.1.0 Rttf2pt1_1.3.8
[157] survival_2.44-1.1 rmarkdown_2.7 munsell_0.5.0 e1071_1.7-0 haven_2.3.1 gtable_0.3.0
[163] bayestestR_0.8.2 extrafont_0.17
A work by Claudiu Papasteri