get_desc_stat_grouping: Get Descriptive Stat for the whole sample and stratified by a...

get_desc_stat_groupingR Documentation

Get Descriptive Stat for the whole sample and stratified by a grouping variable

Description

This function generates descriptive statistics for the whole sample and stratified by a grouping variable. The grouping variable cannot have NA. For all other categorical variables, NA will be replaced with Unknown.

Usage

get_desc_stat_grouping(
  dat,
  grouping,
  test = T,
  raw = F,
  median_vars = NULL,
  detail = F,
  detail_simple = F,
  highlight = F,
  highlight_p = 0.05,
  paired = F,
  sort = F,
  dichotomize = F
)

Arguments

dat

A dataframe

grouping

A string, the name of the grouping variable

test

if you want to perform statistical testing, default is True

raw

if you want to get dataframe raw output, default is False

median_vars

specify the variables that need median(IQR) instead of mean(SD)

detail

if you want to get all the descriptive stat for continuous variables, default is F

detail_simple

if you want to get all the descriptive stat in a condensed version for continuous variables, default is F

highlight

logical, highlight=T highlights p values, default is F

highlight_p

a numeric value of the p value cutoff to highlight, default is 0.05

paired

logical, paired=T uses wilcoxon signed rank tests, default is F

sort

logical, sort =T sorts the variables based on their sequence in the data, default is F, which puts continuous variables first

dichotomize

logical, dichotomize =T calculates p values for each dichotomized version of a categorical variable with overall difference of p<highlight_p,defalt is F

Value

A html table for descriptive statistics


JiyueQin/tidyreport documentation built on Nov. 24, 2024, 9:24 a.m.