Skip to content

Commit

Permalink
Fix inconsistency of using survfit
Browse files Browse the repository at this point in the history
  • Loading branch information
nuno-agostinho committed Feb 3, 2024
1 parent cbd710c commit a50b642
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,12 @@ processSurvTerms <- function(clinical, censoring, event, timeStart,
#' survTerms <- processSurvTerms(clinical, censoring="right", event, timeStart,
#' formulaStr=formulaStr)
#' survfit(survTerms)
survfit.survTerms <- function(survTerms, ...) {
res <- survfit(survTerms$form, data=survTerms$survTime, ...)
res$scale <- survTerms$scale
survfit.survTerms <- function(formula, ...) {
res <- survfit(formula$form, data=formula$survTime, ...)
res$scale <- formula$scale

# Correct group names
groups <- deparse(survTerms$form[[3]])
groups <- deparse(formula$form[[3]])
if (!is.null(res$strata) && groups == "groups") {
name <- paste0("^", groups, "=")
names(res$strata) <- gsub(name, "", names(res$strata))
Expand Down

0 comments on commit a50b642

Please sign in to comment.