hchart.survfit: Plot survival curves

View source: R/utils.R

hchart.survfitR Documentation

Plot survival curves

Description

Plot survival curves

Usage

## S3 method for class 'survfit'
hchart(
  object,
  ...,
  fun = NULL,
  markTimes = TRUE,
  symbol = "plus",
  markerColor = "black",
  ranges = FALSE,
  rangesOpacity = 0.3
)

Arguments

object

survfit object as returned from survfit.survTerms() function

...

Arguments passed on to highcharter::hc_add_series

fun

Name of function or function used to transform the survival curve: log will put y axis on log scale, event plots cumulative events (f(y) = 1-y), cumhaz plots the cumulative hazard function (f(y) = -log(y)), and cloglog creates a complimentary log-log survival plot (f(y) = log(-log(y)) along with log scale for the x-axis.

markTimes

Label curves marked at each censoring time?

symbol

Symbol to use as marker

markerColor

Colour of the marker; if NULL, the respective colour of each series are used

ranges

Plot interval ranges?

rangesOpacity

Opacity of the interval ranges

Value

highchart object to plot survival curves

Examples


# Plot Kaplan-Meier curves
require("survival")
require("highcharter")
leukemia.surv <- survfit(Surv(time, status) ~ x, data = aml)
hchart(leukemia.surv)

# Plot the cumulative hazard function
lsurv2 <- survfit(Surv(time, status) ~ x, aml, type='fleming')
hchart(lsurv2, fun="cumhaz")

# Plot the fit of a Cox proportional hazards regression model
fit <- coxph(Surv(futime, fustat) ~ age, data = ovarian)
ovarian.surv <- survfit(fit, newdata=data.frame(age=60))
hchart(ovarian.surv, ranges = TRUE)

nuno-agostinho/psichomics documentation built on Feb. 11, 2024, 11:16 p.m.