plot.subgroupAnalysis: plot.subgroupAnalysis

View source: R/plot.subgroupAnalysis.R

plot.subgroupAnalysisR Documentation

plot.subgroupAnalysis

Description

This function operates on a "subgroupAnalysis" object to produce a formatted table and a forest plot

Usage

## S3 method for class 'subgroupAnalysis'
plot(x, ...)

Arguments

x

- a subgroupAnalysis object

...

- passed on to plotConfidence

Details

This function produces a formatted table of a subgroupAnalysis object and adds a forest plot. If further details needs attention before plotting is is advisable use adjust the table produced by the summary function and then plotting with the plotConfidence function

Author(s)

Christian Torp-Pedersen

See Also

subgroupAnalysis, plotConfidence

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")),
             sex=factor(sex))]
fit_cox <- coxph(Surv(observationTime,dead)~treatment,data=traceR)
# Selected subgroups - univariable analysis
sub_cox <- subgroupAnalysis(fit_cox,traceR,treatment="treatment",
  subgroup=c("smoking","sex","wmi2","abd2")) # subgroups as character string
plot(sub_cox)  

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