Fix var shifting in advanced.Rmd: by geo group, handling time gaps #53
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.
Fix problem with lags not being calculated by geo group. Also edit to handle any time gaps within a geo group, or omissions at beginning or end of data set due to lag=0 not being included or covered by the range of shifts.
Current approach uses a lot of
full_join
s (potentially slow?) and makesprob_arx
involve the separate:=
functionality of bothrlang
anddata.table
, which could be confusing. An alternative (below) would be using pivoting to perform the join, shown below. But this would be slightly more fragile to derive other forecasters from, as it requires the variables to have the same type, and if a variable is mapped to 0 rows, it will be silently omitted rather than filled in withNA
s.