Skip to content

Conversation

@ayushsingh9720
Copy link

Summary

This Pull Request addresses issue #6512 by making the error message in melt.data.table more informative when a user provides column names in measure.vars that do not exist in the dataset.

Changes

  • R/fmelt.R: Added a pre-check for character measure.vars. It uses setdiff() to identify exactly which variables are missing from the data and reports them specifically.
  • inst/tests/tests.Rraw: Added a new test case (ID 2154.1) to verify that the specific error message is triggered correctly.
  • src/fmelt.c: Cleaned up the C logic to ensure it remains a robust fallback, while the primary informative error is handled in R.

Impact

Instead of a generic:
Error: One or more values in 'measure.vars' is invalid.

Users will now see:
Error: One or more values in 'measure.vars' is invalid; please fix by removing [z1]

This change improves the developer experience by pinpointing the exact typo or missing column in the function call.

Closes #6512

@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.97%. Comparing base (291a711) to head (4a82e90).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7549   +/-   ##
=======================================
  Coverage   98.97%   98.97%           
=======================================
  Files          87       87           
  Lines       16733    16738    +5     
=======================================
+ Hits        16561    16566    +5     
  Misses        172      172           

☔ 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.

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.

melt error message for bad measure.vars could be more informative/specific

1 participant