processSurvTerms {psichomics} | R Documentation

## Process survival curves terms to calculate survival curves

### Description

Process survival curves terms to calculate survival curves

### Usage

    processSurvTerms(clinical, censoring, event, timeStart, timeStop = NULL,
      group = NULL, formulaStr = NULL, coxph = FALSE, scale = "days",
      followup = "days_to_last_followup", survTime = NULL)

### Arguments

`clinical` | Data frame: clinical data
`censoring` | Character: censor using "left", "right", "interval" or "interval2"
`event` | Character: name of column containing time of the event of interest
`timeStart` | Character: name of column containing starting time of the interval or follow up time
`timeStop` | Character: name of column containing ending time of the interval (only relevant for interval censoring)
`group` | Character: group relative to each patient
`formulaStr` | Character: formula to use
`coxph` | Boolean: fit a Cox proportional hazards regression model? FALSE by default
`scale` | Character: rescale the survival time to "days", "weeks", "months" or "years"
`followup` | Character: name of column containing follow up time
`survTime` | survTime object: times to follow up, time start, time stop and event (optional)

### Details

If `survTime` is NULL, the survival times will be fetch from the clinical dataset according to the names given in `timeStart`, `timeStop`, `event` and `followup`. This can became quite slow when using the function in a for loop. If these variables are constant, consider running the function `getAttributesTime` to retrieve the time of such columns once and hand the result to the `survTime` argument of this function.

### Value

A list with a `formula` object and a data frame with terms needed to calculate survival curves

### Examples

    clinical <- read.table(text = "2549   NA ii  female
                                    840   NA i   female
                                     NA 1204 iv    male
                                     NA  383 iv  female
                                   1293   NA iii   male
                                     NA 1355 ii    male")
    names(clinical) <- c("patient.days_to_last_followup",
                         "patient.days_to_death",
                         "patient.stage_event.pathologic_stage",
                         "patient.gender")
    timeStart  <- "days_to_death"
    event      <- "days_to_death"
    formulaStr <- "patient.stage_event.pathologic_stage + patient.gender"
    survTerms  <- processSurvTerms(clinical, censoring="right", event, timeStart,
                                   formulaStr=formulaStr)

[Package psichomics version 1.8.2 Index]