Learn R Programming

descsuppR (version 1.2)

descrSurvEstimate: descrSurvEstimate

Description

build a description table for survival estimates

Usage

descrSurvEstimate(
  S,
  strata,
  stratorder,
  survname = "survival time",
  evaltimes = c(3, 5),
  evaltimeunits = "years",
  digits = 2,
  includeNAs = TRUE,
  includeNonNAs = TRUE,
  missingName = "missing",
  nonNAsName = "N",
  stratheader = TRUE,
  pval = FALSE,
  pvals_formatting = TRUE,
  pvals_digits = 2,
  pvals_signiflev = 0.05,
  hr = FALSE
)

Value

a character matrix

Arguments

S

survival objects from Surv

strata

a list of vectors containing strata. If the vectors are ordered factors the columns will be used in the given order.

stratorder

(list of) character vector for the order of the reported columns. Overrides any order of strata

survname

the name of the survival time, e.g. 'DFS'

evaltimes

numeric vector. for which times to calculate the survival estimate

evaltimeunits

the unit of the survival times (years, months, ...)

digits

round to

includeNAs

boolean. Include number of NAs in the output?

includeNonNAs

Logical; if TRUE, include a column reporting the number of non-missing (non-NA) observations in the output table. Default is TRUE.

missingName

character. name of the rows with missing numbers. Defaults to "missing".

nonNAsName

Character string; the name to use as the column heading for the number of non-missing (non-NA) values. Default is "N".

stratheader

boolean. print the stratheader? Turn off for inclusion into a bigger table

pval

boolean. if TRUE, the p value from a cox model is printed in a separate column

pvals_formatting

boolean. If FALSE report numbers, else report formatted strings (via prettyPvalue)

pvals_digits

integer. Number of digits for p value formatting. Ignored when pvals_formatting==FALSE. Defaults to 2

pvals_signiflev

double. The significance level for bold p value formatting. Ignored when pvals_formatting==FALSE. Defaults to 0.05

hr

boolean. if TRUE, the hazard ratio (with confidence interval) is printed as well. (only has an effect if pval==TRUE)

Author

Andreas Leha

Details

calculate the survival estimates at the specified times and return a nicely formatted table

Examples

Run this code
if (require("survival")) {

  S <- Surv(aml$time, aml$status)

  descrSurvEstimate(S,
                    evaltimes=c(19, 24),
                    evaltimeunits="months")
}

Run the code above in your browser using DataLab