Issue #559: Ensure output of add_coverage() is an object of class forecast_quantile#586
Merged
Issue #559: Ensure output of add_coverage() is an object of class forecast_quantile#586
add_coverage() is an object of class forecast_quantile#586Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #586 +/- ##
==========================================
- Coverage 85.15% 85.14% -0.01%
==========================================
Files 21 21
Lines 1711 1710 -1
==========================================
- Hits 1457 1456 -1
Misses 254 254 ☔ View full report in Codecov by Sentry. |
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR closes #559.
add_coverage()used to return adata.table(), even if it was called on an object of classforecast_quantile. This was due to internal computations: the functionquantile_to_interval()returns adata.tableand when merging the newly computed columns with the existing data, adata.tablewas produced.In addition,
transform_forecasts()had a similar issue. This was due to a call toas.data.table().This PR
merge(), solving the issue foradd_coverage()as.data.table()withas_forecast()fortransform_forecasts()as_forecast()twice produces the same object. I added this test becauseadd_coverage()currently runsas_forecast()and I thought it was a good idea to have a test that runningas_forecast()several times is fine.data.table::to make the code style more consistentAdditional thoughts:
as.data.table()in the code. All of these would make an object lose its classes. I opened Check all calls to `as.data.table() to make sure they are not dropping classes we want to keep #587 for this.Checklist
lintr::lint_package()to check for style issues introduced by my changes.I have added a news item linked to this PR.