Learn R Programming

Publish (version 2023.01.17)

plot.subgroupAnalysis: plot.subgroupAnalysis

Description

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

Usage

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

Arguments

x

- a subgroupAnalysis object

...

- passed on to plotConfidence

Author

Christian Torp-Pedersen

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

See Also

subgroupAnalysis, plotConfidence

Examples

Run this code
#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)  

Run the code above in your browser using DataLab