← Back to all sparks
U

units

ANALYTICS
Velocity0.0

Measurement units for R

units reaches 1.0 by rewriting its parser and accepting the breakage that comes with it.

measurement unitsr packageudunits2breaking parser changeggplot2 integration
Current state
units attaches physical units to R vectors on top of the udunits2 library, covering arithmetic, conversion and ggplot2 scales. Version 1.0-0 replaced the unit-expression tokenizer so numbers are consistently treated as prefixes, and expressions like ml/min/1.73m^2 now parse the way physiologists write them. Printing follows NIST conventions, and 1.0-1 is a fix pass over memory handling and parser edge cases.
Where it's heading
The long 0.8-x run was accretion — ggplot2 scales absorbed from ggforce, ud_convert(), matrix methods, steady performance work — while known parsing defects stayed in place. The 1.0 release finally traded backwards compatibility for correct parsing, and 1.0-1's pointer-wrapping and exception-propagation work suggests the C++ glue is being hardened behind it. Fixes cluster at the udunits2 boundary, which remains the main source of surprises.
Prediction
Expect continued patch releases against udunits2 quirks and the new tokenizer's fallout rather than new surface area, with the ggplot2 integration and conversion helpers already in place.

Recent moves

  1. 5mo ago

    Memory-leak and udunits2 parsing fixes after 1.0

    The consolidation pass behind the 1.0 tokenizer: pointers wrapped to stop leaks on error paths, udunits2 exception propagation checked, and a workaround for units containing 'per' such as percent and person.

    View source ↗
  2. 10mo ago

    New tokenizer parses compound units correctly

    ⚡ SPARK

    The release that ends years of accepted parsing defects, at the cost of changing results for anyone who relied on the old behaviour. NIST printing rules, matrix multiplication and convert_to_base() land alongside it.

    View source ↗
  3. 1y ago

    Copy semantics fix in ud_convert(); C++17 for old R

    A two-line patch stopping ud_convert() from mutating its input, plus a build-standard fix for older R versions.

    View source ↗
  4. 1y ago

    cbind/rbind methods, ud_convert() and broad fixes

    One of the larger accretion releases: matrix binding methods, a vector conversion helper, several performance passes and a run of arithmetic and ggplot2 fixes. Typical of the 0.8-x habit of widening surface without touching the parser.

    View source ↗
  5. 1y ago

    Silences a CRAN compiler warning

    A single-line release clearing a -Wformat-security warning on CRAN. No user-visible change.

    View source ↗
  6. 2y ago

    Restores simplify=FALSE for identical units

    Reverts a prior behaviour change so units_options(simplify = FALSE) is respected again on identical division and multiplication, plus a ggplot2 scale fix.

    View source ↗