Learn R Programming

IPDFileCheck (version 0.8.1)

get_summary_gtsummary: Function to return the summary table using gtsummary package

Description

Function to return the summary table using gtsummary package

Usage

get_summary_gtsummary(
  the_data,
  selectvar,
  byvar = NULL,
  no_digits = 2,
  label = NULL
)

Value

the summary using gtsummarys tbl_summary option

Arguments

the_data

a data frame

selectvar

variables to be selected for summary

byvar

A column name (quoted or unquoted) in data.

no_digits

no of digits to diaply, by default it is 2 Summary statistics will be calculated separately for each level of the by variable. If NULL, summary statistics are calculated using all observations.

label

List of formulas specifying variables labels,

Examples

Run this code
trial <- gtsummary::trial
table1 <- get_summary_gtsummary(trial, c("trt", "age", "grade"),
byvar = "trt")

Run the code above in your browser using DataLab