survival: A function for survival analysis.

View source: R/survival.R

survivalR Documentation

A function for survival analysis.

Description

An easy wrapper around survival analysis as implemented in the packages survival and survminer. This package is meant to easily facilitate survival analysis for test variables (given in testvardf), using time-to-event and event-status variables (given in clinvardf). It also supports multivariable modelling using other variables in clinvardf, which are called according to their column names as provided by multivarnames.

Usage

survival(
  testvardf,
  clinvardf,
  vartypes,
  multivarnames,
  timevarname,
  statusvarname,
  outdir
)

Arguments

testvardf
  • a data.frame of variables to test for association with survival, columns = variables, rows = observations. If you want to run a gene expression matrix, then genes need to be columns and samples need to be rows, ie you may need to transpose via the transpose function, t().

clinvardf
  • a data.frame with clinical variables, including time and status columns, columns = variables, rows = observations.

vartypes
  • a character vector of length = ncol(testvardf). Should say either "continuous" or "categorical", for each column of testvardf. If empty, will guess the vartype, defining continuous variables as those with >12 unique values.

multivarnames
  • a character vector. The colnames of clinvardf to include in multivariable modelling, if desired. If empty, does not perform multivar modelling.

timevarname
  • a string, the colname of the column in clinvardf with time to event information.

statusvarname
  • a string, the colname of the column in clinvardf with event information. The event column should be a character vector and should have the word "Censored" (capital C); ie alive/dead should be "Censored" and "Dead", event should be "Censored" and "Event".

outdir
  • a string, the path to write outputs to; defaults to './survival'

Value

Does not return anything; instead, will save survival analysis plots, Cox regression models, and frozen data to outdir.


FerrenaAlexander/FerrenaBulkRNAseq documentation built on Oct. 16, 2022, 8:18 a.m.