A quantity is a “property of a phenomenon, body, or substance, where the property has a magnitude that can be expressed as a number and a reference”. Science and engineering have to deal with all kinds of quantities: length, mass, time, energy, electric charge… Such quantities can be either a result of a measurement (direct measurement) or a combination of measurements (indirect measurement), and are composed of (1) a value (a number representing the measurand), (2) a measurement unit (or magnitude), and (3) a measurement error (or uncertainty).
Originally, computational systems have treated these three components separately. Data consisted of bare numbers, and data transformations and mathematical operations applied to them solely. Units were just metadata, and error propagation was an unpleasant task requiring additional effort and complex operations. Nowadays, many software libraries implement quantity calculus as a method of working with numbers and units in an integrated way, so that operations preserve dimensional correctness. Similarly, some software assist the task of the propagation of uncertainty. Unfortunately, quantity calculus and error propagation are seldom integrated in a complete solution.
The r-quantities project aims at this by developing and maintaining two core packages:
- The units package supports measurement units in R vectors, matrices and arrays: automatic propagation, conversion, derivation and simplification of units; raising errors in case of unit incompatibility.
- The errors package supports measurement errors in R vectors, matrices and arrays, with automatic uncertainty propagation and reporting.
Both packages are integrated into the quantities framework, which provides a complete quantity calculus system for R vectors, matrices and arrays, with automatic propagation, conversion, derivation and simplification of magnitudes and uncertainties. This project gratefully acknowledges financial support from the R Consortium.