Learn R Programming

tableone (version 0.5.0)

summary.TableOne: Shows all results in a TableOne class object

Description

This method shows all the data a CatTable class object has. This includes the (optionally stratified) part with summary statistics and p-values from the approximation method test (chisq.test by default) and exact method test (fisher.test by default).

Usage

## S3 method for class 'TableOne':
summary(object, digits = 1, ...)

Arguments

object
An object that has the CatTable class to be shown.
digits
Number of digits to print.
...
For compatibility with generic. Ignored.

Value

  • It will print the results.

See Also

CreateTableOne, print.TableOne, summary.TableOne, CreateContTable, print.ContTable, summary.ContTable, CreateCatTable, print.CatTable, summary.CatTable

Examples

Run this code
## Load
library(tableone)

## Load Mayo Clinic Primary Biliary Cirrhosis Data
library(survival)
data(pbc)
## Check variables
head(pbc)

## Make categorical variables factors
varsToFactor <- c("status","trt","ascites","hepato","spiders","edema","stage")
pbc[varsToFactor] <- lapply(pbc[varsToFactor], factor)

## Create Table 1 stratified by sex and trt
tableOne <- CreateTableOne(vars = c("time","status","age","ascites","hepato",
                                    "spiders","edema","bili","chol","albumin",
                                    "copper","alk.phos","ast","trig","platelet",
                                    "protime","stage"),
                           strata = c("sex","trt"), data = pbc)

## Just typing the object name will invoke the print.TableOne method
tableOne

## Use the summary.TableOne method for detailed summary
summary(tableOne)

Run the code above in your browser using DataLab