Last data update: 2014.03.03

R: Plot Kaplan-Meier Estimates of Survival Curves for Survival...
kmTCGAR Documentation

Plot Kaplan-Meier Estimates of Survival Curves for Survival Data

Description

Plots Kaplan-Meier estimates of survival curves for survival data.

Usage

kmTCGA(x, times = "times", status = "patient.vital_status",
  explanatory.names = "1", main = "Survival Curves", risk.table = TRUE,
  risk.table.y.text = FALSE, conf.int = TRUE, return.survfit = FALSE,
  pval = FALSE, ...)

Arguments

x

A data.frame containing survival information. See survivalTCGA.

times

The name of time variable.

status

The name of status variable.

explanatory.names

Names of explanatory variables to use in survival curves plot.

main

Title of the plot.

risk.table

Whether to show risk tables.

risk.table.y.text

Whether to show long strata names in legend of the risk table.

conf.int

Whether to show confidence intervals.

return.survfit

Should return survfit object additionaly to survival plot?

pval

Whether to add p-value of the log-rank test to the plot?

...

Further arguments passed to ggsurvplot.

Issues

If you have any problems, issues or think that something is missing or is not clear please post an issue on https://github.com/RTCGA/RTCGA/issues.

Author(s)

Marcin Kosinski, m.p.kosinski@gmail.com

See Also

RTCGA website http://rtcga.github.io/RTCGA/Visualizations.html.

Other RTCGA: RTCGA-package, boxplotTCGA, checkTCGA, convertTCGA, datasetsTCGA, downloadTCGA, expressionsTCGA, heatmapTCGA, infoTCGA, installTCGA, mutationsTCGA, pcaTCGA, readTCGA, survivalTCGA, theme_RTCGA

Examples


## Extracting Survival Data
library(RTCGA.clinical)
survivalTCGA(BRCA.clinical, OV.clinical, extract.cols = "admin.disease_code") -> BRCAOV.survInfo

# first munge data, then extract survival info
library(dplyr)
BRCA.clinical %>%
    filter(patient.drugs.drug.therapy_types.therapy_type %in%
               c("chemotherapy", "hormone therapy")) %>%
    rename(therapy = patient.drugs.drug.therapy_types.therapy_type) %>%
    survivalTCGA(extract.cols = c("therapy"))  -> BRCA.survInfo.chemo
                 
# first extract survival info, then munge data                  
    survivalTCGA(BRCA.clinical, 
                 extract.cols = c("patient.drugs.drug.therapy_types.therapy_type"))  %>%
    filter(patient.drugs.drug.therapy_types.therapy_type %in%
               c("chemotherapy", "hormone therapy")) %>%
    rename(therapy = patient.drugs.drug.therapy_types.therapy_type) -> BRCA.survInfo.chemo

## Kaplan-Meier Survival Curves
kmTCGA(BRCAOV.survInfo, explanatory.names = "admin.disease_code",  pval = TRUE)

kmTCGA(BRCAOV.survInfo, explanatory.names = "admin.disease_code", main = "",
       xlim = c(0,4000))
 
kmTCGA(BRCA.survInfo.chemo, explanatory.names = "therapy", xlim = c(0, 3000), conf.int = FALSE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RTCGA)
Welcome to the RTCGA (version: 1.2.2).
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/RTCGA/kmTCGA.Rd_%03d_medium.png", width=480, height=480)
> ### Name: kmTCGA
> ### Title: Plot Kaplan-Meier Estimates of Survival Curves for Survival Data
> ### Aliases: kmTCGA
> 
> ### ** Examples
> 
> 
> ## Extracting Survival Data
> library(RTCGA.clinical)
> survivalTCGA(BRCA.clinical, OV.clinical, extract.cols = "admin.disease_code") -> BRCAOV.survInfo
> 
> # first munge data, then extract survival info
> library(dplyr)

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

> BRCA.clinical %>%
+     filter(patient.drugs.drug.therapy_types.therapy_type %in%
+                c("chemotherapy", "hormone therapy")) %>%
+     rename(therapy = patient.drugs.drug.therapy_types.therapy_type) %>%
+     survivalTCGA(extract.cols = c("therapy"))  -> BRCA.survInfo.chemo
>                  
> # first extract survival info, then munge data                  
>     survivalTCGA(BRCA.clinical, 
+                  extract.cols = c("patient.drugs.drug.therapy_types.therapy_type"))  %>%
+     filter(patient.drugs.drug.therapy_types.therapy_type %in%
+                c("chemotherapy", "hormone therapy")) %>%
+     rename(therapy = patient.drugs.drug.therapy_types.therapy_type) -> BRCA.survInfo.chemo
> 
> ## Kaplan-Meier Survival Curves
> kmTCGA(BRCAOV.survInfo, explanatory.names = "admin.disease_code",  pval = TRUE)
> 
> kmTCGA(BRCAOV.survInfo, explanatory.names = "admin.disease_code", main = "",
+        xlim = c(0,4000))
>  
> kmTCGA(BRCA.survInfo.chemo, explanatory.names = "therapy", xlim = c(0, 3000), conf.int = FALSE)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>