tabSummarize: Tabulate a summary

View source: R/tabSummarize.r

tabSummarizeR Documentation

Tabulate a summary

Description

Tabulate a summary

Usage

tabSummarize(
  formula,
  data,
  digits = 3,
  extra.blank.line = TRUE,
  digits.categorical = 1,
  na.rm = FALSE
)

Arguments

formula

formula specifying what to summarize by what

data

data to summarize

digits

number of significant digits in output

extra.blank.line

a logical indicating if an empty line needs to be inserted between two summaries to improve layout and legibility

digits.categorical

passed to tabStats

na.rm

passed to tabStats

Value

Table with summarized data, of class demoTable

Note

This function is primarily used for demographics tables

See Also

conDataFun1, conDataFun2, conDataFun3, catDataFun, tabStats

Examples

options(width = 150)
pkpdData = example.pkpdData()
ok = duplicated(pkpdData$id) == FALSE
tabSummarize(formula = dose ~ race + wt + bmi + sex, data = pkpdData[ok, ], digits = 3)
pkpdData$sex <- factor(pkpdData$sex, levels = c('M','F'))
tabSummarize(formula = dose ~ race + wt + bmi + sex, data = pkpdData[ok, ], digits = 3)
# check the categorical summary for race
round(table(pkpdData$race[ok], pkpdData$dose[ok]) / apply(table(pkpdData$race[ok],
pkpdData$dose[ok]), 2, sum) * 100)
# OK
myFormula =  dose ~ race + wt + bmi + sex
format(
 tabSummarize(formula = myFormula, data = pkpdData[ok, ], digits = 3)
  , formula = myFormula
)

qPharmetra/qpToolkit documentation built on May 24, 2023, 8:52 a.m.