Skip to content

add function to convert units#399

Merged
Enchufa2 merged 5 commits intor-quantities:mainfrom
dlebauer:convert_units
Mar 7, 2025
Merged

add function to convert units#399
Enchufa2 merged 5 commits intor-quantities:mainfrom
dlebauer:convert_units

Conversation

@dlebauer
Copy link
Contributor

@dlebauer dlebauer commented Mar 4, 2025

Initial implementation of a function to perform unit conversion without converting to unit class. Fixes #398

Currently duplicates ud_convert defined in the auto-generated RcppExports.R, not sure where the function should live, but currently passes devtools::check()

@dlebauer dlebauer changed the title add function to convert units [WIP] add function to convert units Mar 4, 2025
@dlebauer dlebauer marked this pull request as draft March 4, 2025 18:20
@dlebauer dlebauer changed the title [WIP] add function to convert units add function to convert units Mar 4, 2025
@dlebauer dlebauer marked this pull request as ready for review March 4, 2025 18:22
@codecov
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.86%. Comparing base (e0988ce) to head (c06e4f4).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
R/udunits.R 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #399      +/-   ##
==========================================
- Coverage   91.89%   91.86%   -0.04%     
==========================================
  Files          19       19              
  Lines        1024     1032       +8     
==========================================
+ Hits          941      948       +7     
- Misses         83       84       +1     

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

@Enchufa2
Copy link
Member

Enchufa2 commented Mar 6, 2025

We cannot just overwrite the RcppExports function. With these changes, I have

  • Renamed the C++ function, so that ud_convert can be implemented and exported independently.
  • Added support for symbolic_units to ud_convert.
  • Simplified ud_are_convertible in a similar way.
  • Merged the manual pages and move some tests around to better reflect the code structure.

Any further comments?

@Enchufa2 Enchufa2 merged commit ad2d3e9 into r-quantities:main Mar 7, 2025
9 checks passed
@Enchufa2
Copy link
Member

Enchufa2 commented Mar 7, 2025

Thanks!

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.

Add unit convert function?

2 participants