tabStats: Table Statistics

View source: R/tabStats.r

tabStatsR Documentation

Table Statistics

Description

Determines if variable is continuous or categorical and returns the appropriate summary statistics.

Usage

tabStats(
  x,
  BY,
  digits = 3,
  conFunc1 = conDataFun1,
  conFunc2 = conDataFun2,
  catFunc = catDataFun,
  digits.categorical = 1,
  parName,
  na.rm = FALSE
)

Arguments

x

numeric vector to summarize

BY

stratification argument

digits

number of significant digits in continuous data summaries

conFunc1

defaults to conDataFun1

conFunc2

defaults to conDataFun2

catFunc

defaults to catDataFun

digits.categorical

passed to catFunc

parName

is automatically populated but the parameter name can be specified here by the user.

na.rm

passed to conFunc1 and conFunc2

Value

Appropriate statistic for x

Note

This function is primarily used for demographics tables

See Also

conDataFun1, conDataFun2, conDataFun3, catDataFun, tabSummarize

Examples

pkpdData = example.pkpdData()
ok = duplicated(pkpdData$id) == FALSE
tabStats(x = pkpdData$race[ok], BY = list(dose = pkpdData$dose[ok]))
tabStats(x = pkpdData$race[ok], BY = list(dose = pkpdData$dose[ok]), 
parName = "Race", digits.categorical = 0)
tabStats(pkpdData$sex[ok], list(dose = pkpdData$dose[ok]))
tabStats(x = pkpdData$wt, BY = list(dose = pkpdData$dose))
tabStats(x = pkpdData$bmi, BY = list(dose = pkpdData$dose))

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