'Digit formatting in qwrap2
How do I control digit output in qwrap2 package? Thus far I have managed to make nice tables for rmarkdown output using the qwrap2 package.
Data set is TheBIG_one2 ; 5 Variables of interest : Dep., Anx., Pan., Neuro., & Neg.
summary_statistics =
list(
"Depression" =
list(
"observations; mean+-(sd)" = ~qwraps2 ::mean_sd(TheBIG_one2$Depressed_Affect_T1, na_rm = TRUE),
"min" = ~min(TheBIG_one2$Depressed_Affect_T1, na.rm = TRUE),
"max" = ~max(TheBIG_one2$Depressed_Affect_T1, na.rm = TRUE),
"Kurtosis" = ~kurtosis(TheBIG_one2$Depressed_Affect_T1, na.rm = TRUE),
"Skew" = ~skewness(TheBIG_one2$Depressed_Affect_T1, na.rm = TRUE),
"Missing" = ~sum(is.na(TheBIG_one2$Depressed_Affect_T1))
),
"Anxiety" =
list(
"observations; mean+-(sd)" = ~qwraps2 ::mean_sd(TheBIG_one2$Anxiety_T1, na_rm = TRUE),
"min" = ~min(TheBIG_one2$Anxiety_T1, na.rm = TRUE),
"max" = ~max(TheBIG_one2$Anxiety_T1, na.rm = TRUE),
"Kurtosis" = ~kurtosis(TheBIG_one2$Anxiety_T1, na.rm = TRUE),
"Skew" = ~skewness(TheBIG_one2$Anxiety_T1, na.rm = TRUE),
"Missing" = ~sum(is.na(TheBIG_one2$Anxiety_T1))
),
"Panic" =
list(
"observations; mean+-(sd)" = ~qwraps2 ::mean_sd(TheBIG_one2$Panic_T1, na_rm = TRUE),
"min" = ~min(TheBIG_one2$Panic_T1, na.rm = TRUE),
"max" = ~max(TheBIG_one2$Panic_T1, na.rm = TRUE),
"Kurtosis" = ~kurtosis(TheBIG_one2$Panic_T1, na.rm = TRUE),
"Skew" = ~skewness(TheBIG_one2$Panic_T1, na.rm = TRUE),
"Missing" = ~sum(is.na(TheBIG_one2$Panic_T1))
),
"Neuroticism" =
list(
"observations; mean+-(sd)" = ~qwraps2 ::mean_sd(TheBIG_one2$Neuroticism_T1, na_rm = TRUE),
"min" = ~min(TheBIG_one2$Neuroticism_T1, na.rm = TRUE),
"max" = ~max(TheBIG_one2$Neuroticism_T1, na.rm = TRUE),
"Kurtosis" = ~kurtosis(TheBIG_one2$Neuroticism_T1, na.rm = TRUE),
"Skew" = ~skewness(TheBIG_one2$Neuroticism_T1, na.rm = TRUE),
"Missing" = ~sum(is.na(TheBIG_one2$Neuroticism_T1))
),
"Negative Affect" =
list(
"observations; mean+-(sd)" = ~qwraps2 ::mean_sd(TheBIG_one2$Negative_Affect_T1, na_rm = TRUE),
"min" = ~min(TheBIG_one2$Negative_Affect_T1, na.rm = TRUE),
"max" = ~max(TheBIG_one2$Negative_Affect_T1, na.rm = TRUE),
"Kurtosis" = ~kurtosis(TheBIG_one2$Negative_Affect_T1, na.rm = TRUE),
"Skew" = ~skewness(TheBIG_one2$Negative_Affect_T1, na.rm = TRUE),
"Missing" = ~sum(is.na(TheBIG_one2$Negative_Affect_T1))
))
I use this code to build table
Table1 = qwraps2::summary_table(TheBIG_one2, summary_statistics)
I have 3 tables for 3 times, so
Table_Output = cbind(Table1, Table2, Table3)
print(Table_Output,
rtitle = "Internalizing Scores; No Log Transformations",
cnames = c("Time 1", "Time 2", "Time 3"))
For the life of me I can not get my skew & kurtosis values to round to 3 digits. I am not sure where to put the arguments.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

