summary.subgroupAnalysis: summary.subgroupAnalysis

View source: R/summary.subgroupAnalysis.R

summary.subgroupAnalysisR Documentation

summary.subgroupAnalysis

Description

This function operates on a "subgroupAnalysis" object to produce a formatted table.

Usage

## S3 method for class 'subgroupAnalysis'
summary(
  object,
  digits = 3,
  eps = 0.001,
  subgroup.p = FALSE,
  keep.digital = FALSE,
  ...
)

Arguments

object

- a subgroupAnalysis object

digits

- number of digits for risk ratios

eps

- lowest value of p to be shown exactly, others will be "<eps"

subgroup.p

- present p-values for analyses in subgroups

keep.digital

- prevents formatting risk ratio and confidence limits. Useful for cases when further manipulations of rows and columns prior to adding a forest plot is relevant.

...

- not currently used

Details

This function produces a formatted or unformatted table of a subgroupAnalysis object. A forest plot can be added with the plot function.

Value

A data.frame with formatted values for subgroups

Author(s)

Christian Torp-Pedersen

See Also

subgroupAnalysis

Examples

#load libraries
library(Publish)
library(survival)
library(data.table)
data(traceR) #get dataframe traceR
setDT(traceR)
traceR[,':='(wmi2=factor(wallMotionIndex<0.9,levels=c(TRUE,FALSE), 
                labels=c("bad","good")),
             abd2=factor(abdominalCircumference<95, levels=c(TRUE,FALSE), 
                labels=c("slim","fat")))]
traceR[,sex:=as.factor(sex)] # all subgroup variables needs to be factor                
traceR[observationTime==0,observationTime:=1]           
# univariate analysis of smoking in subgroups of age and sex
# Basic model from randomised study - but observed for 12 years
fit_cox <- coxph(Surv(observationTime,dead)~treatment,data=traceR)
sub_cox <- subgroupAnalysis(fit_cox,traceR,treatment="treatment",
  subgroup=c("smoking","sex","wmi2","abd2")) # subgroups as character string
summary(sub_cox)   

Publish documentation built on Jan. 18, 2023, 1:08 a.m.