summary.subgroupAnalysis: summary.subgroupAnalysis

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/summary.subgroupAnalysis.R

Description

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

Usage

1
2
3
4
5
6
7
8
9
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#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)   

Example output

Loading required package: prodlim
   subgroups   level sample_placebo sample_trandolapril event_placebo
1:   smoking   never            220                 229           177
2:   smoking   prior            223                 230           182
3:   smoking current            428                 413           292
4:       sex       0            252                 249           199
5:       sex       1            621                 627           453
6:      wmi2     bad            161                 146           148
7:      wmi2    good            712                 730           504
8:      abd2    slim            427                 389           324
9:      abd2     fat            403                 435           296
   event_trandolapril time_placebo time_trandolapril HazardRatio pinteraction
1:                173       402841            444578   0.8933862        0.478
2:                175       364652            463322   0.7869748        0.478
3:                280       916218            962251   0.9246684        0.478
4:                183       439904            500893   0.8250863        0.408
5:                448      1248683           1374234   0.9129109        0.408
6:                133       183764            199046   0.8739884        0.848
7:                498      1504823           1676081   0.8969549        0.848
8:                274       813728            842340   0.8312951        0.329
9:                319       791326            932424   0.9301327        0.329
   subgroup Lower     confint
1:     <NA> 0.724 0.724-1.102
2:     <NA> 0.639 0.639-0.969
3:     <NA> 0.785 0.785-1.089
4:     <NA> 0.675 0.675-1.009
5:     <NA> 0.801 0.801-1.040
6:     <NA> 0.691 0.691-1.105
7:     <NA> 0.792 0.792-1.015
8:     <NA> 0.708 0.708-0.976
9:     <NA> 0.794 0.794-1.090

Publish documentation built on Jan. 8, 2021, 5:37 p.m.