tabSummarize | R Documentation |
Tabulate a summary
tabSummarize(
formula,
data,
digits = 3,
extra.blank.line = TRUE,
digits.categorical = 1,
na.rm = FALSE
)
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 |
na.rm |
passed to |
Table with summarized data, of class demoTable
This function is primarily used for demographics tables
conDataFun1
, conDataFun2
, conDataFun3
, catDataFun
, tabStats
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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.