Skip to content

Reinclusion of .max_keys = Inf in autoplot.epi_workflow - #483

Merged
dajmcdon merged 5 commits into
djm/summer-cleaningfrom
jmr/max_keys-fix
Jul 20, 2026
Merged

Reinclusion of .max_keys = Inf in autoplot.epi_workflow#483
dajmcdon merged 5 commits into
djm/summer-cleaningfrom
jmr/max_keys-fix

Conversation

@JavierMtzRdz

Copy link
Copy Markdown
Contributor

Checklist

Please:

  • Make sure this PR is against "dev", not "main".
  • Request a review from one of the current epipredict main reviewers:
    dajmcdon.
  • Make sure to bump the version number in DESCRIPTION and NEWS.md.
    Always increment the patch version number (the third number), unless you are
    making a release PR from dev to main, in which case increment the minor
    version number (the second number).
  • Describe changes made in NEWS.md, making sure breaking changes
    (backwards-incompatible changes to the documented interface) are noted.
    Collect the changes under the next release number (e.g. if you are on
    0.7.2, then write your changes under the 0.8 heading).
  • Consider pinning the epiprocess version in the DESCRIPTION file if
    • You anticipate breaking changes in epiprocess soon
    • You want to co-develop features in epipredict and epiprocess

Change explanations for reviewer

This PR restores .max_keys = Inf in autoplot.epi_workflow and adds a test to ensure autoplot is working.

Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch

@JavierMtzRdz JavierMtzRdz changed the title Jmr/max keys fix Reinclusion of .max_keys = Inf in autoplot.epi_workflow Jul 2, 2026
@JavierMtzRdz JavierMtzRdz mentioned this pull request Jul 2, 2026
5 tasks
@JavierMtzRdz
JavierMtzRdz marked this pull request as ready for review July 2, 2026 18:25
@JavierMtzRdz
JavierMtzRdz requested a review from dajmcdon as a code owner July 2, 2026 18:25
@dajmcdon

dajmcdon commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@JavierMtzRdz Thanks for catching this, I'm happy to add back since it works with epiprocess/dev. Do we have any idea which version starts to break? Currently, epipredict DESCRIPTION has epiprocess >= 0.11.2. Perhaps we also wait to merge the other until an update makes it from dev to main?

@dajmcdon

dajmcdon commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

(I'd rather the README runs based on the DESCRIPTION requirements, but I don't want to also leave around potential bugs that will be annoying to find later.)

@dajmcdon

dajmcdon commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

(I think I'm doing this correctly)

Locally running epiprocess 0.12.0.999, on this branch I get:

> devtools::build_readme()
ℹ Installing epipredict in temporary libraryBuilding [/Users/dajmcdon/Documents/Delphi/epipredict/README.Rmd](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html#)

Quitting from README.Rmd:323-341 [plotting_forecast]
Error in autoplot_check_viable_response_vars(object, ..., non_key_cols = non_key_cols) : 
  Can't select columns with `Inf`.
✖ Can't convert from `Inf` <double> to <integer> due to loss of precision.
Error:
! ! in callr subprocess.
Caused by error in `autoplot_check_viable_response_vars(object, ..., non_key_cols = non_key_cols)`:
! Can't select columns with `Inf`.
✖ Can't convert from `Inf` <double> to <integer> due to loss of precision.

@JavierMtzRdz

JavierMtzRdz commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@dajmcdon The new feature was added after declaring the last version epiprocess 0.12.0.999. It looks like cmu-delphi/epiprocess@dev isn't necessary, since the Remotes section installs packages from "HEAD", which is dev for epiprocess. I just tested the error with an older version of epiprocess, and it was resolved by installing epipredict, provided the session is restarted before rendering the README. Could you restart the session and let me know if that resolves the error?

> pak::pkg_install("cmu-delphi/epiprocess@main")

#> ℹ No downloads are needed
#> ✔ 1 pkg + 42 deps: kept 42 [1.7s]
> rmarkdown::render("README.Rmd")
#> 
#> 
#> processing file: README.Rmd
#> |.............................................        |  85% [plotting_forecast]     
#> 
#> Error in `autoplot_check_viable_response_vars()`:
#>   ! Can't select columns with `Inf`.
#> ✖ Can't convert from `Inf` <double> to <integer> due to loss of precision.
#> Backtrace:
#>   ▆
#> 1. ├─ggplot2::autoplot(four_week_ahead, observed_response = cases_deaths)
#> 2. ├─epipredict:::autoplot.canned_epipred(four_week_ahead, observed_response = #> cases_deaths)
#> 3. │ ├─ggplot2::autoplot(...)
#> 4. │ └─epipredict:::autoplot.epi_workflow(...)
#> 5. │   ├─ggplot2::autoplot(...)
#> 6. │   └─epiprocess:::autoplot.epi_df(...)
#> 7. │     └─epiprocess:::autoplot_check_viable_response_vars(...)
#> 8. │       └─tidyselect::eval_select(rlang::expr(c(...)), object)
#> 9. │         └─tidyselect:::eval_select_impl(...)
#> 10. │           ├─tidyselect:::with_subscript_errors(...)
#> 11. │           │ └─base::withCallingHandlers(...)
#> 12. │           └─tidyselect:::vars_select_eval(...)
#> 13. │             └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
#> 14. │               └─tidyselect:::eval_c(expr, data_mask, context_mask)
#> 15. │                 └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = #> init)
#> 16. │                   └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
#> 17. │                     └─tidyselect:::as_indices_sel_impl(...)
#> 18. │                       └─tidyselect:::as_indices_impl(...)
#> 19. │                         └─vctrs::vec_as_subscript(x, logical = "error", call = #> call, arg = arg)
#> 20. └─rlang::cnd_signal(x) at vctrs/R/subscript.R:39:3
#> 
#> Quitting from README.Rmd:323-341 [plotting_forecast]
#> 
#> 
> devtools::install()
#> ── pak::local_install_deps() ────────────────────────────────────────────────
#> 
#> → Will update 1 package.
#> → All 2 packages (0 B) are cached.
#> + epiprocess 0.12.0 → 0.12.0.9999 👷🏿‍♂️🔧 (GitHub: 364e390)
#> 
#> ! epiprocess is loaded in the current R session, you probably need to
#> restart R after the installation.
#> ? Do you want to continue (Y/n) y
#> ℹ No downloads are needed, 1 pkg is cached
#> ✔ Installed epiprocess 0.12.0.9999 (github::cmu-delphi/epiprocess@364e390) (45ms)
#> ✔ 109 deps: kept 96, upd 1 [5.8s]                                           
#> ── R CMD build ──────────────────────────────────────────────────────────────
#> ✔  checking for file ‘/Users/javiermtz/Library/Mobile Documents/com~apple~CloudDocs#> /code-projects/delphi/epipredict/DESCRIPTION’ ...
#> ─  preparing ‘epipredict’: (584ms)
#> ✔  checking DESCRIPTION meta-information ...
#> ─  checking for LF line-endings in source and make files and shell scripts
#> ─  checking for empty or unneeded directories
#> Removed empty directory ‘epipredict/README_cache/gfm’
#> Removed empty directory ‘epipredict/README_cache’
#> NB: this package now depends on R (>= 4.1.0)
#> WARNING: Added dependency on R >= 4.1.0 because package code uses the
#> pipe |> or function shorthand \(...) syntax added in R 4.1.0.
#> File(s) using such syntax:
#>   ‘clean_f_name.Rd’ ‘step_climate.R’ ‘step_epi_slide.Rd’
#> ─  building ‘epipredict_0.2.7.tar.gz’
#> Warning in utils::tar(filepath, pkgname, compression = compression, compression_level = 9L,  :
#> storing paths of more than 100 bytes is not portable:
#> ‘epipredict/vignettes/backtesting_cache/html/arx-kweek#> preliminaries_69c7e599d6e135b30dc1d738b4464e7d.RData’
#> Warning in utils::tar(filepath, pkgname, compression = #> , compression_level = 9L,  :
#> storing paths of more than 100 bytes is #>  portable:
#> ‘epipredict/vignettes/backtesting_cache#> html/compare_single_with_result_b7619871cc83c10c4534a6d124cbab76.RData’
#> Warning in utils::tar(filepath, pkgname, #>  = compression, compression_level = 9L,  :
#> storing paths of #>  than 100 bytes is not portable:
#> ‘epipredict#> vignettes/backtesting_cache/html#> plot_just_revisioning_374ada453235acc9c36cfe21a49f4514.RData’
#> Warning in utils::tar#> filepath, pkgname, compression = compression, compression_level = 9L,  :
#> storing paths of more than 100 bytes is not portable:
#> ‘epipredict/vignettes/backtesting_cache/html#> plot_revision_example_81283a78dfcdc6d5cc45246db83f250f.RData’
#> 
#> ── R CMD INSTALL ────────────────────────────────────────────────────────────
#> Running /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL \
#> /var/folders/nq/107726sj27n2rv3dtzgb9b680000gn/T//RtmpTGISBL/epipredict_0.2.7.tar.gz \
#> --install-tests 
#> * installing to library ‘/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources#> library’
#> * installing *source* package ‘epipredict’ ...
#> ** this is package ‘epipredict’ version ‘0.2.7’
#> ** using staged installation
#> ** R
#> ** inst
#> ** tests
#> ** byte-compile and prepare package for lazy loading
#> Warning message:
#> package ‘parsnip’ was built under R version 4.5.2 
#> ** help
#> *** installing help indices
#> *** copying figures
#> ** building package indices
#> ** installing vignettes
#> ** testing if installed package can be loaded from temporary location
#> Warning: package ‘parsnip’ was built under R version 4.5.2
#> ** testing if installed package can be loaded from final location
#> Warning: package ‘parsnip’ was built under R version 4.5.2
#> ** testing if installed package keeps a record of temporary installation path
#> * DONE (epipredict)
#> Warning message:
#> In get(Info[i, 1], envir = env) :
#> internal error 1 in R_decompress1 with libdeflate
#> 
> rstudioapi::restartSession(clean = TRUE)

#> Restarting R session...

> rmarkdown::render("README.Rmd")

#> 
#> processing file: README.Rmd
#> 
#> output file: README.knit.md
#> /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/pandoc +RTS#> -K512m -RTS README.knit.md --to gfm-tex_math_gfm-yaml_metadata_block --from markdow#> +autolink_bare_uris+tex_math_single_backslash --output README.md --template /Librar#> /Frameworks/R.framework/Versions/4.5-arm64/Resources/library/rmarkdown/rmarkdow#> /templates/github_document/resources/default.md 
#> /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/pandoc +RTS#> -K512m -RTS README.md --to html4 --from gfm-tex_math_gfm --output README.html --embe#> -resources --standalone --syntax-highlighting pygments --template /Library/Frameworks/#> .framework/Versions/4.5-arm64/Resources/library/rmarkdown/rmarkdown/template#> /github_document/resources/preview.html --variable 'github-markdown-css:/Librar#> /Frameworks/R.framework/Versions/4.5-arm64/Resources/library/rmarkdown/rmarkdow#> /templates/github_document/resources/github.css' --metadata pagetitle=PREVIEW --mathjax#> 
#> 
#> Preview created: README.html
#> 
#> Output created: README.md

@JavierMtzRdz JavierMtzRdz reopened this Jul 2, 2026
@JavierMtzRdz

JavierMtzRdz commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Since epiprocess 0.12.0.9999 captures all changes before release, perhaps the version you have installed is from before the autoplot update. I believe it's safer to increase the minor version number and release epiprocess on main first as you mentioned. Working on this.

@JavierMtzRdz

Copy link
Copy Markdown
Contributor Author

@dajmcdon epiprocess 0.13.0 has now moved from dev to main, and I have updated the required version in this PR. It now flags incompatible versions when using devtools::build_readme(). Then devtools::install() installs the correct version, allowing devtools::build_readme() to succeed on my machine. Please confirm whether this now works for you. An example shown below.

I also made a small change to pivot_quantiles_longer to produce valid epi_df files (since epiprocess 0.13.0 includes a left_join.epi_df method that decays to tibble when an invalid epi_df is returned by a *_join method). An alternative is to reframe pivot_quantiles_longer to use pivot_longer.epi_df, but that would require more changes.

>  pak::pkg_install("cmu-delphi/epiprocess@v0.12.0")
✔ Loading metadata database ... doneWill update 1 package.The package (0 B) is cached.
+ epiprocess 0.13.00.12.0 👷🏿‍♀️🔧 (GitHub: adaa348)
? Do you want to continue (Y/n) 
yNo downloads are needed, 1 pkg is cachedInstalled epiprocess 0.12.0 (github::cmu-delphi/epiprocess@adaa348) (43ms)
✔ 1 pkg + 42 deps: kept 42, upd 1 [50.2s]                              
>  devtools::build_readme(quiet = FALSE)
ℹ Building [/Users/javiermtz/Library/Mobile Documents/com~apple~CloudDocs/code-projects/delphi/epipredict/README.Rmd](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html#)
! 1 epipredict dependency is out of date.                           
  Update it with [pak::local_install_dev_deps()](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html#).
   epiprocess (behind: 0.12.0 vs 0.13.0)
ℹ Installing epipredict in temporary library
── pak::local_install_deps() ───────────────────────────────────────────────────────────────────────────────────────
 
→ The package (0 B) is cached.No downloads are needed:  [273ms] 
── R CMD INSTALL ───────────────────────────────────────────────────────────────────────────────────────────────────
Running /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL \
  '/Users/javiermtz/Library/Mobile Documents/com~apple~CloudDocs/code-projects/delphi/epipredict' \
  --with-keep.source --install-tests --no-docs --no-multiarch --no-demo 
* installing to library/private/var/folders/nq/107726sj27n2rv3dtzgb9b680000gn/T/RtmpBxUNsU/temp_libpath9be4685b13a4* installing *source* packageepipredict...
** this is packageepipredictversion0.2.7** using staged installation
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
Warning message:
packageparsnipwas built under R version 4.5.2 
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  namespaceepiprocess0.12.0 is being loaded, but >= 0.13.0 is required
Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading failed for packageepipredict* removing/private/var/folders/nq/107726sj27n2rv3dtzgb9b680000gn/T/RtmpBxUNsU/temp_libpath9be4685b13a4/epipredictError:
! ! System command 'R' failed

Show Traceback
> devtools::install()
── pak::local_install_deps() ───────────────────────────────────────────────────────────────────────────────────────
                                                                            
→ Will update 1 package.All 2 packages (0 B) are cached.
+ epiprocess 0.12.00.13.0 👷🏾‍♀️🔧 (GitHub: d13345b)
? Do you want to continue (Y/n) 
yNo downloads are needed, 1 pkg is cachedInstalled epiprocess 0.13.0 (github::cmu-delphi/epiprocess@d13345b) (37ms)
✔ 109 deps: kept 108, upd 1 [4.9s]                                         
── R CMD build ─────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file/Users/javiermtz/Library/Mobile Documents/com~apple~CloudDocs/code-projects/delphi/epipredict/DESCRIPTION...preparingepipredict: (559ms)
✔  checking DESCRIPTION meta-information ...checking for LF line-endings in source and make files and shell scriptschecking for empty or unneeded directories
   Removed empty directoryepipredict/README_cache/gfmRemoved empty directoryepipredict/README_cacheNB: this package now depends on R (>= 4.1.0)
     WARNING: Added dependency on R >= 4.1.0 because package code uses the
     pipe |> or function shorthand \(...) syntax added in R 4.1.0.
     File(s) using such syntax:clean_f_name.Rd’ ‘step_climate.R’ ‘step_epi_slide.Rd’
─  buildingepipredict_0.2.7.tar.gzWarning in utils::tar(filepath, pkgname, compression = compression, compression_level = 9L,  :
     storing paths of more than 100 bytes is not portable:epipredict/vignettes/backtesting_cache/html/arx-kweek-preliminaries_69c7e599d6e135b30dc1d738b4464e7d.RDataWarning in utils::tar(filepath, pkgname, compression = compression, compression_level = 9L,  :
     storing paths of more than 100 bytes is not portable:epipredict/vignettes/backtesting_cache/html/compare_single_with_result_b7619871cc83c10c4534a6d124cbab76.RDataWarning in utils::tar(filepath, pkgname, compression = compression, compression_level = 9L,  :
     storing paths of more than 100 bytes is not portable:epipredict/vignettes/backtesting_cache/html/plot_just_revisioning_374ada453235acc9c36cfe21a49f4514.RDataWarning in utils::tar(filepath, pkgname, compression = compression, compression_level = 9L,  :
     storing paths of more than 100 bytes is not portable:epipredict/vignettes/backtesting_cache/html/plot_revision_example_81283a78dfcdc6d5cc45246db83f250f.RData’
   
── R CMD INSTALL ───────────────────────────────────────────────────────────────────────────────────────────────────
Running /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL \
  /var/folders/nq/107726sj27n2rv3dtzgb9b680000gn/T//RtmpBxUNsU/epipredict_0.2.7.tar.gz --install-tests 
* installing to library/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library* installing *source* packageepipredict...
** this is packageepipredictversion0.2.7** using staged installation
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
Warning message:
packageparsnipwas built under R version 4.5.2 
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Warning: packageparsnipwas built under R version 4.5.2
** testing if installed package can be loaded from final location
Warning: packageparsnipwas built under R version 4.5.2
** testing if installed package keeps a record of temporary installation path
* DONE (epipredict)
> devtools::build_readme(quiet = FALSE)
ℹ Building [/Users/javiermtz/Library/Mobile Documents/com~apple~CloudDocs/code-projects/delphi/epipredict/README.Rmd](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html#)Installing epipredict in temporary library                               
── pak::local_install_deps() ───────────────────────────────────────────────────────────────────────────────────────
 
→ The package (0 B) is cached.No downloads are needed:  [230ms] 
── R CMD INSTALL ───────────────────────────────────────────────────────────────────────────────────────────────────
Running /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL \
  '/Users/javiermtz/Library/Mobile Documents/com~apple~CloudDocs/code-projects/delphi/epipredict' \
  --with-keep.source --install-tests --no-docs --no-multiarch --no-demo 
* installing to library/private/var/folders/nq/107726sj27n2rv3dtzgb9b680000gn/T/RtmpBxUNsU/temp_libpath9be42ea3c942* installing *source* packageepipredict...
** this is packageepipredictversion0.2.7** using staged installation
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
Warning message:
packageparsnipwas built under R version 4.5.2 
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Warning: packageparsnipwas built under R version 4.5.2
** testing if installed package can be loaded from final location
Warning: packageparsnipwas built under R version 4.5.2
** testing if installed package keeps a record of temporary installation path
* DONE (epipredict)


processing file: README.Rmd
1/34                         
2/34 [unnamed-chunk-1]       
3/34 [pkgs]                  
4/34                         
5/34 [coloration]            
6/34                         
7/34 [unnamed-chunk-2]       
8/34                         
9/34 [install]               
10/34                         
11/34 [subset_geos]           
12/34                         
13/34 [fc_date]               
14/34                         
15/34 [case_death]            
16/34                         
17/34 [case_death_epidatasets]
18/34                         
19/34 [date]                  
20/34                         
21/34 [outlier]               
22/34                         
23/34 [plot_locs]             
24/34                         
25/34 [show-processed-data]   
26/34                         
27/34 [make-forecasts]        
28/34                         
29/34 [plotting_forecast]     
30/34                         
31/34 [show-single-forecast]  
32/34                         
33/34 [pivot_wider]           
34/34                         
output file: README.knit.md

/Applications/Positron.app/Contents/Resources/app/quarto/bin/tools/aarch64/pandoc +RTS -K512m -RTS README.knit.md --to gfm-tex_math_gfm-yaml_metadata_block --from markdown+autolink_bare_uris+tex_math_single_backslash --output README.md --template /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library/rmarkdown/rmarkdown/templates/github_document/resources/default.md 

Output created: README.md

@dajmcdon
dajmcdon merged commit ef1b4f8 into djm/summer-cleaning Jul 20, 2026
@JavierMtzRdz
JavierMtzRdz deleted the jmr/max_keys-fix branch July 20, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants