Replace deprecated dplyr/tidyselect functions#447
Replace deprecated dplyr/tidyselect functions#447utkarshpawade wants to merge 4 commits intostan-dev:masterfrom
Conversation
- New vignette: example-gallery.Rmd with ~60 thumbnail plot cards organized in a CSS grid layout (PPC, PPD, MCMC, HMC/NUTS sections) - Updated _pkgdown.yml: added Gallery navbar link and article section - Added NEWS.md entry for the new gallery vignette - Uses only built-in example data (no rstanarm dependency)
- Add gallery_card() and gallery_card_cond() helpers to reduce boilerplate HTML - Use absolute URLs for all links - Make thumbnail images clickable by wrapping them in anchor tags - Add alt text (function name) and loading='lazy' to all images - Clean up censoring setup chunk to remove unused variable
There was a problem hiding this comment.
Pull request overview
This PR aims to modernize the codebase by removing deprecated dplyr/tidyselect usages (per #431) to prevent lifecycle warnings and improve forward compatibility, and it also introduces a new documentation “Example Gallery” surfaced in pkgdown.
Changes:
- Replaced deprecated selection and ranking helpers (
one_of(),top_n(),group_indices()pattern) with modern equivalents (all_of(),slice_min(),group_keys()/group_split()). - Added a new “Example Gallery” vignette that renders a thumbnail-based function overview.
- Updated pkgdown config and NEWS to expose/document these updates.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
R/mcmc-intervals.R |
Updates deprecated dplyr/tidyselect usage in intervals/areas helpers. |
NAMESPACE |
Adjusts imports to match new dplyr helpers. |
vignettes/example-gallery.Rmd |
Adds a new vignette that generates a visual gallery of plotting functions. |
_pkgdown.yml |
Adds a “Gallery” navbar item and registers the new article. |
NEWS.md |
Documents the deprecation replacements and the new vignette entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Replaced deprecated `dplyr` and `tidyselect` functions (`top_n`, `one_of`, `group_indices`) with their modern equivalents to ensure future compatibility. (#431) | ||
| * New "Example Gallery" vignette providing a visual overview of all plotting | ||
| functions with thumbnail example plots, organized by category (PPC, PPD, MCMC, | ||
| HMC/NUTS). (#437) |
There was a problem hiding this comment.
The PR title/description focus on replacing deprecated dplyr/tidyselect functions (#431), but this change log entry also includes a new "Example Gallery" vignette and references a different issue/PR number (#437). Consider splitting the gallery work into a separate PR or updating the PR title/description to match the broader scope.
| yrep_cens <- matrix(rexp(n_cens * 50, rate = 0.5), nrow = 50) | ||
| group_cens <- factor(rep(c("A", "B"), each = n_cens / 2)) | ||
| } | ||
| has_survival <- requireNamespace("survival", quietly = TRUE) |
There was a problem hiding this comment.
has_survival is assigned twice in this chunk. The second has_survival <- requireNamespace("survival", quietly = TRUE) is redundant and can be removed to avoid confusion about whether the value can change within the chunk.
| has_survival <- requireNamespace("survival", quietly = TRUE) |
| half_point_width <- .004 * diff(x_lim) | ||
|
|
||
| # Find the density values closest to the point estimate | ||
| point_ests <- intervals %>% | ||
| select(one_of("parameter", "m")) | ||
| select(all_of(c("parameter", "m"))) |
There was a problem hiding this comment.
slice_min() is being called with .data$diff as the first argument, but the first argument should be the data frame (provided by the pipe). As written this will error (or behave incorrectly) because a vector is passed as .data. Use slice_min(order_by = .data$diff, n = 1) (optionally set with_ties to match previous behavior).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #447 +/- ##
==========================================
- Coverage 98.63% 98.63% -0.01%
==========================================
Files 35 35
Lines 5860 5858 -2
==========================================
- Hits 5780 5778 -2
Misses 80 80 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR replaces deprecated functions from
dplyrandtidyselect(dating back to the dplyr 1.0.0 lifecycle changes) to ensure future compatibility and suppress warnings during checks.Changes
top_n()withslice_min().one_of()withall_of().group_indices()logic to use modern equivalents (group_keys()andgroup_split()), asgroup_indices()is deprecated when passed a grouped data frame.