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.
lubridate, sp, measurements, NISTunits, udunits2, units, ggplot2, spacetime, h5, RNetCDF, sos4R
Spatial, SpatioTemporal, Graphics, Phylogenetics, ReproducibleResearch, TimeSeries
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 ...".
For attribution, please cite this work as
Pebesma, et al., "Measurement Units in R", The R Journal, 2016
BibTeX citation
@article{RJ-2016-061, author = {Pebesma, Edzer and Mailund, Thomas and Hiebert, James}, title = {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} }