Skip to content

Commit

Permalink
Updates to survfitms models in {survival} v 3.6.4 (#208)
Browse files Browse the repository at this point in the history
* updates

* Update NEWS.md

* updates

* Update ggcuminc.R
  • Loading branch information
ddsjoberg authored May 8, 2024
1 parent 5db4896 commit d68d7ce
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 214 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ggsurvfit
Title: Flexible Time-to-Event Figures
Version: 1.0.0.9001
Version: 1.0.0.9002
Authors@R: c(
person("Daniel D.", "Sjoberg", , "danield.sjoberg@gmail.com", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0003-0862-2018")),
Expand Down Expand Up @@ -33,7 +33,7 @@ Imports:
gtable,
patchwork (>= 1.1.0),
rlang (>= 1.0.0),
survival (>= 3.4-0),
survival (>= 3.6-4),
tidyr (>= 1.0.0)
Suggests:
covr,
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

* For multi-state models created with `survfit()`, the y-axis label is now "Probability in State". (#205)

* Updated legend position syntax to account for changes in ggplot v3.5.0.
* Updated legend position syntax to account for changes in {ggplot2} v3.5.0.

* The `tidy_survfit()` (and subsequently `ggsurvfit()`) now honor the `survfit(start.time)` if specified. (#192)

* We now allow for negative follow-up times in `tidy_survfit()` (and subsequently `ggsurvfit()`). When negative follow-up times are present users should specify `survfit(start.time)` and we print a note to this effect when not set. (#192)

* As of {survival} v3.6-4, the number censored are now returned as a matrix for multi-state models (i.e. competing risks models). The `tidy_survfit()` function has been updated to account for this new structure and the minimum version of {survival} has been increased to the latest version. (#199)

# ggsurvfit 1.0.0

* By default, a model plot created with `ggsurvfit()` or `ggcuminc()` uses the color aesthetic to plot curves by the stratifying variable(s), and further, `ggcuminc()` uses the linetype aesthetic for plots that contain multiple outcomes (i.e. competing events). We now introduce the global option `"ggsurvfit.switch-color-linetype"` to switch these defaults, giving users more flexibility over the output figures. Furthermore, when the `linetype_aes=` argument is called in a situation when it does not apply, it will be silently ignored (previously, an error message _may_ have been thrown). (#166)
Expand Down
1 change: 1 addition & 0 deletions R/ggcuminc.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#' Plot Cumulative Incidence
#'
#' @description
#' Plot a cumulative incidence object created with `tidycmprsk::cuminc()`
#' or a multi-state object created with `survfit2()`.
#' Read more on multi-state models [here](https://cran.r-project.org/package=survival/vignettes/compete.pdf).
Expand Down
6 changes: 3 additions & 3 deletions R/tidy_survfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ tidy_survfit <- function(x,
df_tidy <-
df_tidy %>%
dplyr::filter(!.data$state %in% "(s0)") %>%
dplyr::select(-dplyr::all_of("n.risk")) %>%
dplyr::select(-dplyr::all_of(c("n.risk", "n.censor"))) %>%
dplyr::left_join(
df_tidy %>% dplyr::filter(.data$state %in% "(s0)") %>% dplyr::select(dplyr::any_of(c("strata", "time", "n.risk"))),
df_tidy %>% dplyr::filter(.data$state %in% "(s0)") %>% dplyr::select(dplyr::any_of(c("strata", "time", "n.risk", "n.censor"))),
by = intersect(c("strata", "time"), names(df_tidy))
) %>%
dplyr::relocate("n.risk", .after = "time") %>%
dplyr::relocate(dplyr::any_of(c("n.risk", "n.censor")), .after = "time") %>%
dplyr::rename(outcome = "state")
}

Expand Down
2 changes: 2 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ adjuvant
behaviour
cowplot
cuminc
geom's
geoms
geom’
ggcuminc
Expand All @@ -39,6 +40,7 @@ survfit
tablemab
tibble
tidycmprsk
unmapped
unremarkably
unstratified
vismab
47 changes: 39 additions & 8 deletions man/stepribbon.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d68d7ce

Please sign in to comment.