Skip to content

Replace deprecated case_match() with replace_values() - #153

Merged
jt14den merged 1 commit into
mainfrom
fix/case-match-to-replace-values
Aug 23, 2026
Merged

jt14den merged 1 commit into
mainfrom
fix/case-match-to-replace-values

Conversation

@jt14den

@jt14den jt14den commented Aug 23, 2026

Copy link
Copy Markdown
Member

Closes #152.

nickyjgarland flagged on #149 that case_match() (used to replace the superseded recode()) has itself since been deprecated in dplyr 1.2.0, in favor of recode_values()/replace_values().

All 6 call sites in episodes/03-data-cleaning-and-transformation.Rmd and episodes/05-reproducible-reports.Rmd used .default = <same column> (i.e. "keep unmatched values as-is"), which is exactly replace_values()'s built-in behavior, so this converts each case_match(x, ..., .default = x) call to replace_values(x, ...), dropping the now-unneeded .default argument. Also updated the objectives, function-list bullet, keypoints, and the prose paragraph explaining .default (rewritten to explain why replace_values() doesn't need it).

Verified against real dplyr 1.2.1: old case_match() vs. new replace_values() produce identical() output on both synthetic data (with an unmatched value and an NA) and the real 10,000-row books.csv for both subCollection and format.

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Thank you!

Thank you for your pull request 😃

🤖 This automated message can help you check the rendered files in your submission for clarity. If you have any questions, please feel free to open an issue in {sandpaper}.

If you have files that automatically render output (e.g. R Markdown), then you should check for the following:

  • 🎯 correct output
  • 🖼️ correct figures
  • ❓ new warnings
  • ‼️ new errors

Rendered Changes

🔍 Inspect the changes: https://github.com/LibraryCarpentry/lc-r/compare/md-outputs..md-outputs-PR-153

The following changes were observed in the rendered markdown documents:

 01-intro-to-r.md                                   |   10 +-
 02-starting-with-data.md                           |    2 +-
 03-data-cleaning-and-transformation.md             |  160 +-
 04-data-viz-ggplot.md                              |   18 +-
 05-reproducible-reports.md                         |    6 +-
 config.yaml (gone)                                 |   86 -
 ...t-rendered-boxplot-exercise-subcollection-1.png |  Bin 49562 -> 49553 bytes
 ...a-viz-ggplot-rendered-boxplot-with-points-1.png |  Bin 42909 -> 42752 bytes
 ...data-viz-ggplot-rendered-unnamed-chunk-14-1.png |  Bin 39625 -> 38789 bytes
 fig/04-data-viz-ggplot-rendered-violin-plot-1.png  |  Bin 38570 -> 38794 bytes
 ...oducible-reports-rendered-plot-high-usage-1.png |  Bin 46952 -> 46985 bytes
 md5sum.txt                                         |   32 +-
 renv.lock (gone)                                   | 3962 --------------------
 13 files changed, 116 insertions(+), 4160 deletions(-)
What does this mean?

If you have source files that require output and figures to be generated (e.g. R Markdown), then it is important to make sure the generated figures and output are reproducible.

This output provides a way for you to inspect the output in a diff-friendly manner so that it's easy to see the changes that occur due to new software versions or randomisation.

⏱️ Updated at 2026-08-23 02:01:26 +0000

@jt14den
jt14den requested a review from nickyjgarland August 23, 2026 02:00
@jt14den
jt14den merged commit 75b637d into main Aug 23, 2026
5 checks passed
@jt14den
jt14den deleted the fix/case-match-to-replace-values branch August 23, 2026 18:56
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.

change deprecated case_match for recode_values

1 participant