Generate a descriptive summary table for specified variables in a dataset.
Usage
CreateSummaryTable(
data,
variables = NULL,
digits = 2,
Relabel = TRUE,
Ordinal = lifecycle::deprecated(),
TreatOrdinalAs = "Categorical",
ScrollBoxHeight = "700px",
Data = lifecycle::deprecated(),
Variables = lifecycle::deprecated(),
numdecimals = lifecycle::deprecated()
)Arguments
- data
The dataset containing the variables of interest.
- variables
A character vector specifying the variables for which summary statistics will be calculated.
- digits
Number of decimal places to round the summary statistics.
- Relabel
Logical, indicating whether to use variable labels as column headers.
- Ordinal
Deprecated logical compatibility option; use
TreatOrdinalAsinstead.- TreatOrdinalAs
How ordinal variables are handled. This numeric descriptive table accepts
"Continuous"or"Exclude".- ScrollBoxHeight
Height of the scroll box for displaying the table.
- Data
Deprecated (since 19.15.0). Use
datainstead.- Variables
Deprecated (since 19.15.0). Use
variablesinstead.- numdecimals
Deprecated (since 19.15.0). Use
digitsinstead.
Examples
# \donttest{
data(SampleData)
data(SampleVariableTypes)
df_Labelled <- RevalueData(SampleData, SampleVariableTypes)$RevaluedData
# Distribution diagnostics for six biomarkers
summary_table <- CreateSummaryTable(
data = df_Labelled,
variables = c("AXL", "Adiponectin", "Ferritin", "MMP7", "tau", "p_tau"),
digits = 2,
ScrollBoxHeight = "320px"
)
#> Warning: no DISPLAY variable so Tk is not available
# `browsable()` is what renders the HTML on this page; printing suffices
# in Quarto or R Markdown
htmltools::browsable(htmltools::HTML(as.character(summary_table)))
Descriptive Summary Table. IQR, Skewness, and Kurtosis are highlighted in yellow if they are indicative of a non-normal distribution. Pct.Valid is highlighted in red if over 30% of data is missing
Variable
label
Mean
Std.Dev
Median
IQR
Min
Max
Skewness
Kurtosis
N.Valid
Pct.Valid
1
AXL
AXL receptor tyrosine kinase
0.30
0.45
0.28
0.62
-0.92
1.52
0.01
-0.24
333
100
2
Adiponectin
Adiponectin
-5.22
0.67
-5.22
0.86
-7.06
-3.47
0.14
-0.21
333
100
3
Ferritin
Ferritin
2.75
0.78
2.73
1.01
0.61
4.93
0.02
0.03
333
100
4
MMP7
Matrix metalloproteinase 7
-3.83
1.55
-3.77
2.05
-8.40
-0.20
-0.04
-0.27
333
100
5
tau
Tau protein
5.74
0.56
5.74
0.8
4.60
7.17
0.22
-0.52
233
69.97
6
p_tau
Phosphorylated tau protein
4.04
0.46
4.04
0.63
2.96
5.47
0.28
-0.11
333
100
# }
