Measurement Units in R

Abstract:

We briefly review SI units, and discuss R packages that deal with measurement units, their compatibility and conversion. Built upon udunits2 and the UNIDATA udunits library, we introduce the package units that provides a class for maintaining unit metadata. When used in expression, it automatically converts units, and simplifies units of results when possible; in case of incompatible units, errors are raised. The class flexibly allows expansion beyond predefined units. Using units may eliminate a whole class of potential scientific programming mistakes. We discuss the potential and limitations of computing with explicit units.

Cite PDF Tweet

Published

Dec. 11, 2016

Received

Jul 12, 2016

DOI

10.32614/RJ-2016-061

Volume

Pages

8/2

486 - 494

CRAN packages used

lubridate, sp, measurements, NISTunits, udunits2, units, ggplot2, spacetime, h5, RNetCDF, sos4R

CRAN Task Views implied by cited packages

Spatial, SpatioTemporal, Graphics, Phylogenetics, ReproducibleResearch, TimeSeries

Footnotes

    Reuse

    Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

    Citation

    For attribution, please cite this work as

    Pebesma, et al., "The R Journal: Measurement Units in R", The R Journal, 2016

    BibTeX citation

    @article{RJ-2016-061,
      author = {Pebesma, Edzer and Mailund, Thomas and Hiebert, James},
      title = {The R Journal: Measurement Units in R},
      journal = {The R Journal},
      year = {2016},
      note = {https://doi.org/10.32614/RJ-2016-061},
      doi = {10.32614/RJ-2016-061},
      volume = {8},
      issue = {2},
      issn = {2073-4859},
      pages = {486-494}
    }