get_stats: Get description stats for survival analysis

View source: R/get_stats.R

get_statsR Documentation

Get description stats for survival analysis

Description

Calculate descriptive statistics grouped by strata defined by the variable strata for different outcome variables.

Usage

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,
  ...
)

Arguments

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 default_ref parameter.

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 FALSE it outputs LaTeX formatting

header_count

Set to TRUE if you want to add a header count, e.g. Smoking; No. 25 observations, where there is a new line after the factor name. If you want a different text for the second line you can specifically use the sprintf formatting, e.g. "No. %s patients".

continuous_fn

The method to describe continuous variables. The default is describeMean.

...

additional arguments passed on to getDescriptionStatsBy function from Gmisc package


MBender1992/emR documentation built on Feb. 18, 2025, 9:21 a.m.