metrumresearchgroup / pmtables

TeX tables for pharmacometrics.
https://metrumresearchgroup.github.io/pmt-book
11 stars 1 forks source link

silence tidyselect deprecation warnings #303

Closed kyleam closed 11 months ago

kyleam commented 1 year ago

Running the test suite with the most recent tidyselect (1.2.0, released 2022/10) leads to a good number of warnings. This series silences all of those. I've confirmed that the tests pass with tidyselect 1.1.2 and 1.2.0.

More information: https://www.tidyverse.org/blog/2022/10/tidyselect-1-2-0/#using-data-inside-selections

kyleam commented 11 months ago

Rebased to resolve a conflict. (One of these spots was taken care of by 494069a, but the end result is slightly different due to another tweak in adf7db0.)

Verified that tests/check passed, and there are no tidyselect warnings. (A dplyr and rlang warning have popped up since this PR was opened, but I think it makes sense to leave this PR focused on tidyselect deprecations.)

range-diff ``` 1: 6060bbe = 1: 6901a43 treewide: don't use .data in tidy selection context 2: cfc0438 ! 2: bfffcdb treewide: avoid external vectors in tidy selection context @@ Metadata Author: Kyle Meyer ## Commit message ## - treewide: avoid external vectors in tidy selection context + demo_summarize_cont: avoid external vectors in tidy selection context - Two spots lead to a warning like this when running the tests with the - most recent tidyselect: + This spot leads to a warning when running the tests with the most + recent tidyselect: Using an external vector in selections was deprecated in tidyselect 1.1.0. @@ R/demographics-table.R: demo_summarize_cont <- function(data, span, cols, fun) { names_glue = "{name}_{.value}" ) cont_table <- pivot_longer(cont_table, -!!sym(span)) - - ## R/yaml-as-df.R ## -@@ R/yaml-as-df.R: yaml_as_df <- function(path, quiet = FALSE) { #nocov start - } - if(exists("cols", meta)) { - cols <- meta[["cols"]] -- ans <- select(ans, cols, tidyselect::everything()) -+ ans <- select(ans, all_of(cols), tidyselect::everything()) - } - ans - } #nocov end 3: 5dae177 = 3: 2a102db pt_demographics: don't use all_of outside selecting function ```