tidysummary.Rmd
tidysummary: A Elegant Approach to Summarizing Clinical Data.
The goal of tidysummary is to streamlines the analysis of clinical data by automatically selecting appropriate statistical descriptions and inference methods based on variable types.
The add_var() function prepares your dataset for downstream analysis by classifying variables into:
Continuous variables: Further subdivided by normality and equal variance assumptions.
Categorical variables: Further subdivided by ordered status and expected frequency.
Specify the variables to summarize in var
and the
grouping variable in group
.
The function can automatically checks normality using statistical tests. You can choose:
The add_summary() function summarize your dataset from add_var() result with:
A summary dataframe with rows as the variables and columns as the group.
Just input the result from add_var()
summary <- datalist %>%
add_summary()
If you want to custom the summary style, You can choose:
TRUE
: By default, include an “Overall” summary
column.
FALSE
: Show only groups summary column.
Format string to override both norm_continuous_format
,
and unnorm_continuous_format
.
Accepted placeholders are {mean}
, {SD}
,
{median}
, {Q1}
, {Q3}
.
Default is {median} ({Q1}, {Q3})
. Accepted placeholders
same as continuous_format
.
Format string for categorical variables. Default is
"{n} ({pct})"
. Accepted placeholders are {n}
and pct.
last
: By default, show only last level.
first
: Show only first level.
all
: show all levels.
summary <- datalist %>%
add_summary(add_overall = T,
continuous_format = "{mean} ± {SD}",
categorical_format = "{n} ({pct})",
binary_show = "last")
The add_summary() function summarize your dataset from add_summary() result with:
A summary_with_p dataframe with rows as the variables and columns as the group.
Just input the result from add_summary()
If you want to custom the summary_with_p column, You can choose: