cmu-delphi / cmu-delphi/epipredict

fix: minimize `suppressWarnings` calls

Open
#323 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
18
Forks
13
Avg merge
21d 58m
Merged PRs (30d)
1

Description

From discussions in #319.

### `flatline_forecaster`

When I remove `suppressWarnings` [here](https://github.com/cmu-delphi/epipredict/blob/8a516e96bbd0d647291700c32da9d4c5182e9f13/R/flatline_forecaster.R#L72), that makes the tests [here](https://github.com/cmu-delphi/epipredict/blob/8a516e96bbd0d647291700c32da9d4c5182e9f13/tests/testthat/test-layer_residual_quantiles.R#L84-L89) fail. The warning is:

```
Detected an unexpected many-to-many relationship between `x` and `y`.
i Row 1 of `x` matches multiple rows in `y`.
i Row 1 of `y` matches multiple rows in `x`.
i If a many-to-many relationship is expected, set `relationship = "many-to-many"` to silence this warning.
```

### `cdc_baseline_forecaster`

If you remove the `suppressWarnings` there, you get the following in the tests

```
Using an external vector in selections was deprecated in tidyselect 1.1.0.
i Please use `all_of()` or `any_of()` instead.
# Was:
data %>% select(col_names)

# Now:
data %>% select(all_of(col_names))

Backtrace:

1. ├─epipredict::cdc_baseline_forecaster(...) at test-snapshots.R:39:3
2. │ ├─... %>% ... at epipredict/R/cdc_baseline_forecaster.R:105:3
3. │ ├─stats::predict(wf, new_data = latest)
4. │ └─epipredict:::predict.epi_workflow(wf, new_data = latest)
5. │ ├─epipredict::apply_frosting(object, components, new_data, ...) at epipredict/R/epi_workflow.R:272:3
6. │ └─epipredict:::apply_frosting.epi_workflow(...) at epipredict/R/frosting.R:337:3
7. │ ├─epipredict::slather(la, components, workflow, new_data) at epipredict/R/frosting.R:403:7
8. │ └─epipredict:::slather.layer_unnest(la, components, workflow, new_data) at epipredict/R/layers.R:206:3
9. │ └─components$predictions %>% tidyr::unnest(col_names) at epipredict/R/layer_unnest.R:34:5
10. ├─dplyr::mutate(., target_date = forecast_date + ahead * args_list$data_frequency)
11. ├─dplyr::select(., -time_value)
12. ├─tibble::as_tibble(.)
13. ├─tidyr::unnest(., col_names)
14. ├─epiprocess:::unnest.epi_df(., col_names)
15. │ └─dplyr::dplyr_reconstruct(NextMethod(), data) at cmu-delphi-epiprocess-00c0a85/R/methods-epi_df.R:239:3
16. │ └─dplyr:::dplyr_new_data_frame(data)
17. │ ├─row.names %||% .row_names_info(x, type = 0L)
18. │ └─base::.row_names_info(x, type = 0L)
19. ├─base::NextMethod() at cmu-delphi-epiprocess-00c0a85/R/methods-epi_df.R:239:3
20. └─tidyr:::unnest.data.frame(., col_names)
21. └─tidyselect::eval_select(expr = enquo(cols), data = data, allow_rename = FALSE)
22. └─tidyselect:::eval_select_impl(...)
23. ├─tidyselect:::with_subscript_errors(...)
24. │ └─base::withCallingHandlers(...)
25. └─tidyselect:::vars_select_eval(...)
26. └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
27. └─tidyselect:::eval_sym(expr, data_mask, context_mask)
```

### `dist_quantiles`

Removing [this one](https://github.com/cmu-delphi/epipredict/blob/8a516e96bbd0d647291700c32da9d4c5182e9f13/R/dist_quantiles.R#L33) gave no warnings or errors in tests, but I'm not sure what this was intended to suppress, so I'm not comfortable removing that.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.