r-quantities / units

Measurement units for R
https://r-quantities.github.io/units
172 stars 27 forks source link

Preserve names with unit conversion #338

Closed billdenney closed 1 year ago

billdenney commented 1 year ago

Fix #305

Now, names are preserved with unit conversion. The underlying issue is that the C-connection function ud_convert drops the names. I don't know how to fix that, and it seems to be used only at the location that I found in the code.

codecov[bot] commented 1 year ago

Codecov Report

Base: 91.55% // Head: 91.54% // Decreases project coverage by -0.00% :warning:

Coverage data is based on head (ead4493) compared to base (cc947e2). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #338 +/- ## ========================================== - Coverage 91.55% 91.54% -0.01% ========================================== Files 19 19 Lines 935 934 -1 ========================================== - Hits 856 855 -1 Misses 79 79 ``` | [Impacted Files](https://codecov.io/gh/r-quantities/units/pull/338?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=r-quantities) | Coverage Δ | | |---|---|---| | [R/conversion.R](https://codecov.io/gh/r-quantities/units/pull/338/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=r-quantities#diff-Ui9jb252ZXJzaW9uLlI=) | `87.95% <100.00%> (ø)` | | | [src/udunits.cpp](https://codecov.io/gh/r-quantities/units/pull/338/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=r-quantities#diff-c3JjL3VkdW5pdHMuY3Bw) | `90.09% <100.00%> (-0.10%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=r-quantities). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=r-quantities)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

Enchufa2 commented 1 year ago

Good catch! Thanks for looking into this. Then let's try to just preserve those names in ud_convert(). Please, try the commit above.

billdenney commented 1 year ago

Since it passes the added test, it works as desired (and better than my fix since it works at the source).