Skip to content

Commit

Permalink
do intersection date conversion only if has contents
Browse files Browse the repository at this point in the history
  • Loading branch information
nmdefries committed Aug 24, 2023
1 parent 2a7bca9 commit 9bf9404
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R-packages/evalcast/R/get_covidhub_predictions.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ get_forecast_dates <- function(forecasters,
start_date,
end_date,
date_filtering_function) {
forecast_dates <- as_date(forecast_dates)
forecaster_dates <- vector("list", length = length(forecasters))
for (i in seq_len(length(forecasters))) {
forecaster_dates[[i]] <- lubridate::as_date(get_covidhub_forecast_dates(forecasters[i]))
}
if (length(forecast_dates) != 0) {
forecast_dates <- as_date(forecast_dates)
# Intersect acts oddly with dates. If foo = as_date(bar), then foo == bar is
# true, but (foo %in% bar) is false and intersect(foo, bar) is an empty
# vector. Additionally, intersect returns a numeric object instead of a
Expand Down

0 comments on commit 9bf9404

Please sign in to comment.