autoplot.clustcurv_surv: Visualization of 'clustcurv_surv' objects with ggplot2...

Description Usage Arguments Details Value Author(s) Examples

View source: R/autoplot.clustcurv_surv.R

Description

Useful for drawing the estimated survival functions grouped by color and the centroids (mean curve of the curves pertaining to the same group).

Usage

1
2
3
4
## S3 method for class 'clustcurv_surv'
autoplot(object = object,
  groups_by_colour = TRUE, centers = FALSE, conf.int = FALSE,
  censor = FALSE, xlab = "Time", ylab = "Survival", ...)

Arguments

object

Object of clustcurv_surv class.

groups_by_colour

A specification for the plotting groups by color.

centers

Draw the centroids (mean of the curves pertaining to the same group) into the plot. By default it is FALSE.

conf.int

Logical flag indicating whether to plot confidence intervals.

censor

Logical flag indicating whether to plot censors.

xlab

A title for the x axis.

ylab

A title for the y axis.

...

Other options.

Details

See help page of the function autoplot.survfit.

Value

A ggplot object, so you can use common features from ggplot2 package to manipulate the plot.

Author(s)

Nora M. Villanueva and Marta Sestelo.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(survival)
library(clustcurv)
library(condSURV)
library(ggplot2)
library(ggfortify)
data(veteran)
data(colonCS)

cl2 <- kgroups_surv(time = veteran$time, status = veteran$status,
fac = veteran$celltype, k = 2, algorithm = "kmeans")

autoplot(cl2)
autoplot(cl2, groups_by_colour = FALSE)
autoplot(cl2, centers = TRUE)

colonCSm <- data.frame(time = colonCS$Stime, status = colonCS$event,
                      nodes = colonCS$nodes)

table(colonCSm$nodes)
colonCSm$nodes[colonCSm$nodes == 0] <- NA
colonCSm <- na.omit(colonCSm)
colonCSm$nodes[colonCSm$nodes >= 10] <- 10
table(colonCSm$nodes) # ten levels

res <- clustcurv_surv(colonCSm$time, status = colonCSm$status,
       fac = colonCSm$nodes, algorithm = "kmeans", nboot = 20)

autoplot(res)
autoplot(res, groups_by_colour = FALSE)
autoplot(res, centers = TRUE)

clustcurv documentation built on May 2, 2019, 3:43 a.m.