Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix g_km bug when multiple estimates are made at max time #1280

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
edelarua marked this conversation as resolved.
Show resolved Hide resolved
gg_plt <- gg_plt +
theme(
legend.position.inside = c(1, 0.5),
Expand Down
Loading