Learn R Programming

survMisc (version 0.4.2)

autoplot.tableAndPlot: Arrange and plot a survival plot, it's legend and a table.

Description

Uses gridExtra::gridArrange to arrange a plot, it's legend and a table.

Usage

## S3 method for class 'tableAndPlot':
autoplot(object, ...,
    hideTabLeg = TRUE, plotHeight = 0.75, tabHeight = 0.25)

Arguments

object
An object of class tableAndPlot as returned by autoplot.survfit
...
Additional arguments (not implemented)
hideTabLeg
Suppress table legend. If supTabLeg = FALSE then a legend will also be shown for the table
plotHeight
Height of plot
tabHeight
Height of table

Value

  • A graph, as plotted by gridExtra::grid.arrange

Details

Arguments to plotHeigth and tabHeight are best specified as fractions adding to one e.g. $0.85 + 0.15 =1$. Other ggplot2 objects may be plotted using this method. They need to be stored in a list of two (with element table if hideTabLeg is to be used). The class of this list should be modified with class(list1) <- c("tableAndPlot", "list")

Examples

Run this code
data(kidney, package="KMsurv")
a1 <- autoplot(survfit(Surv(time, delta) ~ type, data=kidney), type="fill")
autoplot(a1)
a1 <- autoplot(survfit(Surv(time, delta) ~ type, data=kidney), type="fill")
data(bmt, package="KMsurv")
s2 <- survfit(Surv(time=t2, event=d3) ~ group, data=bmt)
autoplot(autoplot(s2))

Run the code above in your browser using DataLab