Skip to content

Replace deprecated reshape2::melt() with base R and tidyr equivalents#479

Open
utkarshpawade wants to merge 3 commits intostan-dev:masterfrom
utkarshpawade:migrate-reshape2-to-tidyr
Open

Replace deprecated reshape2::melt() with base R and tidyr equivalents#479
utkarshpawade wants to merge 3 commits intostan-dev:masterfrom
utkarshpawade:migrate-reshape2-to-tidyr

Conversation

@utkarshpawade
Copy link
Contributor

Fixes #478

Summary

  • Replace all 9 uses of reshape2::melt() across 5 source files with
    base::as.data.frame.table(), tidyr::pivot_longer(), and explicit
    dplyr::bind_rows() constructions
  • Remove reshape2 from DESCRIPTION Imports — it is no longer needed
  • Update 10 vdiffr visual snapshots for ppd_stat plots affected by the migration
  • Update inline documentation to remove references to reshape2::melt()

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 81.48148% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.55%. Comparing base (906cd5c) to head (ee24593).

Files with missing lines Patch % Lines
R/bayesplot-extractors.R 66.66% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #479      +/-   ##
==========================================
- Coverage   98.66%   98.55%   -0.12%     
==========================================
  Files          35       35              
  Lines        5860     5888      +28     
==========================================
+ Hits         5782     5803      +21     
- Misses         78       85       +7     

☔ 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
Copy link
Contributor Author

utkarshpawade commented Mar 15, 2026

@jgabry The 10 uncovered lines are in R/bayesplot-extractors.R, specifically the log_posterior.CmdStanMCMC and nuts_params.CmdStanMCMC methods which require a CmdStan installation to test. These lines were already uncovered before this PR, I just replaced uncovered reshape2 code with equivalent uncovered base R code. No regression in coverage.

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 reshape2::melt() with tidyr::pivot_longer() and base R equivalents

2 participants