get_stats | R Documentation |
Calculate descriptive statistics grouped by strata defined by the variable strata
for
different outcome variables.
get_stats(
data,
strat,
outcome,
digits = 1,
add_total_col = "last",
show_all_values = TRUE,
hrzl_prop = FALSE,
statistics = FALSE,
html = TRUE,
header_count = TRUE,
continuous_fn = Gmisc::describeMedian,
...
)
data |
data.frame or data.table |
strat |
variable used for stratification. |
outcome |
outcome variable to be summarized. |
digits |
the number of decimals used. |
add_total_col |
This adds a total column to the resulting table. You can also specify if you want the total column "first" or "last" in the column order. |
show_all_values |
Show all values in proportions. For factors with only two values
it is most sane to only show one option as the other one will just be a complement
to the first, i.e. we want to convey a proportion. For instance sex - if you know
gender then automatically you know the distribution of the other sex as it's 100 % - other %.
To choose which one you want to show then set the |
hrzl_prop |
This is default FALSE and indicates that the proportions are to be interpreted in a vertical manner. If we want the data to be horizontal, i.e. the total should be shown and then how these differ in the different groups then set this to TRUE. |
statistics |
Add statistics, fisher test for proportions and Wilcoxon for continuous variables. See details below for more customization. |
html |
If HTML compatible output should be used. If |
header_count |
Set to |
continuous_fn |
The method to describe continuous variables. The
default is |
... |
additional arguments passed on to |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.