Replace deprecated case_match() with replace_values() - #153
Conversation
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:
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: 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 |
Closes #152.
nickyjgarland flagged on #149 that
case_match()(used to replace the supersededrecode()) has itself since been deprecated in dplyr 1.2.0, in favor ofrecode_values()/replace_values().All 6 call sites in
episodes/03-data-cleaning-and-transformation.Rmdandepisodes/05-reproducible-reports.Rmdused.default = <same column>(i.e. "keep unmatched values as-is"), which is exactlyreplace_values()'s built-in behavior, so this converts eachcase_match(x, ..., .default = x)call toreplace_values(x, ...), dropping the now-unneeded.defaultargument. Also updated the objectives, function-list bullet, keypoints, and the prose paragraph explaining.default(rewritten to explain whyreplace_values()doesn't need it).Verified against real
dplyr 1.2.1: oldcase_match()vs. newreplace_values()produceidentical()output on both synthetic data (with an unmatched value and an NA) and the real 10,000-rowbooks.csvfor bothsubCollectionandformat.