R/survival-formulas.r

Defines functions is.survival.expression extract.survival.variables

extract.survival.variables <- function(formula) {
    if (class(formula) == "formula")
        formula <- as.character(formula)[2]
    strsplit(sub("Surv\\(([^)]+)\\).*", "\\1", formula), "[ ]*,[ ]*")[[1]]
}

is.survival.expression <- function(formula) {
    if (class(formula) == "formula")
        formula <- as.character(formula)[2]
    length(grep("Surv\\(.+\\)", formula)) > 0
}
perishky/ewaff documentation built on Nov. 10, 2024, 4:53 p.m.