Skip to content

Commit

Permalink
Extend 28d5fb to handle previous version of survfit
Browse files Browse the repository at this point in the history
  • Loading branch information
chjackson committed Apr 17, 2024
1 parent 28d5fbf commit d5537c7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/summary.flexsurvmix.R
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,15 @@ ajfit_flexsurvmix <- function(x, maxt=NULL, startname="Start", B=NULL){
} else newdata <- NULL
statenames <- c(startname,x$evnames)

ajlong <- ajfit(x) %>%

ajlong <- ajfit(x)
## survival package changed 04/2024 to include state names in survfit Aalen-Johansen output
if (any(names(ajlong)=="pstate..s0.")) # handle both old and new versions
ajlong <- ajlong %>%
dplyr::rename("pstate._s0_"="pstate..s0.", ## rename name chosen by survfit()
"lower._s0_"="lower..s0.", ## since double dot confuses names_sep
"upper._s0_"="upper..s0.") %>%
"upper._s0_"="upper..s0.")
ajlong <- ajlong %>%
tidyr::pivot_longer(cols = c(tidyselect::starts_with("pstate."),
tidyselect::starts_with("lower."),
tidyselect::starts_with("upper.")),
Expand Down

0 comments on commit d5537c7

Please sign in to comment.