Skip to content

Fix #431: Replace deprecated dplyr/tidyselect functions#448

Merged
jgabry merged 5 commits intostan-dev:masterfrom
utkarshpawade:issue-431-dplyr-deprecations
Mar 10, 2026
Merged

Fix #431: Replace deprecated dplyr/tidyselect functions#448
jgabry merged 5 commits intostan-dev:masterfrom
utkarshpawade:issue-431-dplyr-deprecations

Conversation

@utkarshpawade
Copy link
Contributor

Fixes #431

This PR replaces deprecated functions from dplyr and tidyselect (dating back to the dplyr 1.0.0 lifecycle changes) to ensure future compatibility and suppress warnings during checks.

Changes made

  • Replaced top_n() with slice_min().
  • Replaced one_of() with all_of().
  • Refactored group_indices() logic to use modern equivalents (group_keys() and group_split()), as group_indices() is deprecated when passed a grouped data frame.

Copilot AI review requested due to automatic review settings March 10, 2026 13:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates bayesplot’s MCMC interval/area data helpers to avoid deprecated dplyr/tidyselect APIs (per the dplyr 1.0.0 lifecycle changes), reducing warnings and improving forward compatibility.

Changes:

  • Replaced one_of() selections with all_of().
  • Replaced top_n() with slice_min() for closest-density selection.
  • Refactored grouped-index splitting away from group_indices(group_df) to group_split() + group_keys(), and documented the change in NEWS.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
R/mcmc-intervals.R Modernizes deprecated selection/ranking/grouping code paths used by mcmc_*_data() helpers.
NEWS.md Adds a development-news bullet noting the deprecation replacements for #431.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.55%. Comparing base (c817061) to head (93afa91).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #448      +/-   ##
==========================================
- Coverage   98.63%   98.55%   -0.09%     
==========================================
  Files          35       35              
  Lines        5860     5864       +4     
==========================================
- Hits         5780     5779       -1     
- Misses         80       85       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@utkarshpawade utkarshpawade requested a review from jgabry March 10, 2026 16:12
That function is also used in mcmc_dens_chains() even though it's not defined in the same R file
Copy link
Member

@jgabry jgabry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added one more new test. I think this is now ready.

@jgabry jgabry merged commit 98a7245 into stan-dev:master Mar 10, 2026
5 of 6 checks passed
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.

Replace deprecated dplyr/tidyselect functions

4 participants