Skip to content

Commit

Permalink
Fix g_km bug when multiple estimates are made at max time (#1280)
Browse files Browse the repository at this point in the history
Fixes #1279
  • Loading branch information
edelarua committed Aug 12, 2024
1 parent 41ce013 commit b01413c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Fixed defaults for formats and labels in `get_formats_from_stats` and `get_labels_from_stats`.
* Fixed bug for linear scaling factor (`scale` parameter) being applied to response but not to rate in `h_glm_count` while all distributions have logarithmic link function.
* Fixed bug in `decorate_grob` that did not handle well empty strings or `NULL` values for title and footers.
* Fixed bug in `g_km` that caused an error when multiple records in the data had estimates at max time.


### Miscellaneous
Expand Down
4 changes: 2 additions & 2 deletions R/g_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ g_km <- function(df,

y_rng <- ylim[2] - ylim[1]

if (yval == "Survival" && data$estimate[data$time == max_time2] > ylim[1] + 0.09 * y_rng &&
data$estimate[data$time == max_time2] < ylim[1] + 0.5 * y_rng) { # nolint
if (yval == "Survival" && all(data$estimate[data$time == max_time2] > ylim[1] + 0.09 * y_rng) &&
all(data$estimate[data$time == max_time2] < ylim[1] + 0.5 * y_rng)) { # nolint
gg_plt <- gg_plt +
theme(
legend.position.inside = c(1, 0.5),
Expand Down

0 comments on commit b01413c

Please sign in to comment.