Learn R Programming

Publish (version 2023.01.17)

summary.univariateTable: Preparing univariate tables for publication

Description

Summary function for univariate table

Usage

# S3 method for univariateTable
summary(
  object,
  n = "inNames",
  drop.reference = FALSE,
  pvalue.stars = FALSE,
  pvalue.digits = 4,
  show.missing = c("ifany", "always", "never"),
  show.pvalues,
  show.totals,
  ...
)

Value

Summary table

Arguments

object

univariateTable object as obtained with function univariateTable.

n

If not missing, show the number of subjects in each column. If equal to "inNames", show the numbers in parentheses in the column names. If missing the value object$n is used.

drop.reference

Logical or character (vector). Decide if line with reference level should be suppressed for factors. If TRUE or "all" suppress for all categorical factors. If 'binary' suppress only for binary variables. Can be character vector in which case reference lines are suppressed for variables that are included in the vector.

pvalue.stars

If TRUE use symnum to parse p-values otherwise use format.pval.

pvalue.digits

Passed to format.pval.

show.missing

Decides if number of missing values are shown in table. Defaults to "ifany", and can also be set to "always" or "never".

show.pvalues

Logical. If set to FALSE the column p-values is removed. If missing the value object$compare.groups[[1]]==TRUE is used.

show.totals

Logical. If set to FALSE the column Totals is removed. If missing the value object$show.totals is used.

...

passed on to labelUnits. This overwrites labels stored in object$labels

Author

Thomas A. Gerds <tag@biostat.ku.dk>

Details

Collects results of univariate table in a matrix.

Examples

Run this code
data(Diabetes)
u <- univariateTable(gender~age+location+Q(BMI)+height+weight,
                data=Diabetes)
summary(u)
summary(u,n=NULL)
summary(u,pvalue.digits=2,"age"="Age (years)","height"="Body height (cm)")

u2 <- univariateTable(location~age+AgeGroups+gender+height+weight,
                data=Diabetes)
summary(u2)
summary(u2,drop.reference=TRUE)
## same but more flexible
summary(u2,drop.reference=c("binary"))
## same but even more flexible
summary(u2,drop.reference=c("gender"))


Run the code above in your browser using DataLab