You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the user inputs ref_time_values before or after the time_values in the epi_df (even if there'd be data in the window), it gives a hard-to-understand error message:
Error: Can't subset columns that don't exist.
✖ Column `slide_value` doesn't exist.
Run `rlang::last_error()` to see where the error occurred.
We should instead detect this case and output an understandable error message.
Examples:
edf = bind_rows(
tibble(geo_value = "ak", time_value = as.Date("2020-01-01") + 1:200, value=1:200),
tibble(geo_value = "al", time_value=as.Date("2020-01-01") + 1:5, value=-(1:5))
) %>%
as_epi_df()
f = function(x, ...) tibble(value=mean(x$value), count=length(x$value))
## --- These cases generate the error: ---
## `ref_time_values` + `align` that result in no slide data, generate the error:
edf %>% group_by(geo_value) %>% epi_slide(f, n=3L, ref_time_values=as.Date("2020-01-01")) # before the first, no data in the slide windows
edf %>% group_by(geo_value) %>% epi_slide(f, n=3L, ref_time_values=as.Date("2020-01-01")+207L) # beyond the last, no data in window
## `ref_time_values` + `align` that should? have slide data, but generate the error:
edf %>% group_by(geo_value) %>% epi_slide(f, n=3L, ref_time_values=as.Date("2020-01-01"), align="left") # before the first, but we'd expect there to be data in the window
edf %>% group_by(geo_value) %>% epi_slide(f, n=3L, ref_time_values=as.Date("2020-01-01")+201L) # beyond the last, but still with data in window
## --- This case doesn't generate the error: ---
## (this doesn't produce an error; the error appears only if the ref time values are out of the range for every group:)
edf %>% group_by(geo_value) %>% epi_slide(f, n=3L, ref_time_values=as.Date("2020-01-01")+200L)
The text was updated successfully, but these errors were encountered:
Merge branch 'main' into epi_slide-error_message
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
When the user inputs
ref_time_values
before or after thetime_value
s in theepi_df
(even if there'd be data in the window), it gives a hard-to-understand error message:We should instead detect this case and output an understandable error message.
Examples:
The text was updated successfully, but these errors were encountered: