Skip to content
ayraa.ai edited this page Feb 22, 2025 · 3 revisions

Background

The R package units implements support for measurement units in R vectors, matrices and arrays, enabling automatic propagation, conversion, derivation and simplification of units, and promoting correctness by raising errors in case of unit incompatibility. It uses the UNIDATA udunits library and unit database for unit compatibility checking and conversion. See the R Journal paper for further details.

the units package covers the need for standard unit conversions, and it enables one-off custom conversions. What is needed and outside the scope of the units package is an ability to convert units for specific substances. One example is that mass to molar conversions are not available (for example one mole of water is 18.02 grams). A more complex example is that atypical units used in medical laboratories are not handled; the blood measurement of alanine aminotransferase has two types of units that are both nonstandard (U/L; ukat/L). See this discussion for further details.

Related work

The substances package will be part of the r-quantities project, which currently consists of:

  • units: Provides measurement units for R vectors.
  • errors: Provides uncertainty propagation for R vectors.
  • quantities: Integrates the 'units' and 'errors' packages for a complete quantity calculus system.
  • constants: Provides the CODATA reference on the fundamental physical constants, units and uncertainty.

There are other software packages dealing to some extent with quantity calculus (see Flater (2016) for further discussion), but, to the best of our knowledge, there are no substance-aware implementations.

Details of your coding project

This project is about the development of a new R package called substances that will enable substance-aware unit conversions, which requires the complete development cycle:

  • Definition and implementation of the substances object.
  • Definition of the architecture and behavior of such object.
  • Implementation of all the necessary methods for different families of generics (arithmetic operators, mathematical functions...).
  • Documentation (manual, examples, vignettes, webpage).
  • Testing (test suite, CI on GitHub Actions).

Expected impact

The new substances library can have an impact in any field of science where unit conversions either between nonstandard units or between units that do not have a universally-defined conversion. Examples include medical unit conversions between conventional and SI units, scientific modeling where mass-molar or other unit conversions may help.

An initial impact will be within the PKNCA R package to allow mass-to-molar conversion for medicines.

Mentors

Tests

Contributors, please do one or more of the following tests before contacting the mentors above.

MENTORS: write several tests that potential contributors can do to demonstrate their capabilities for this particular project. Ask some hard questions that will give you insight about how the contributors write code to solve problems. You'll see that the harder the questions that you ask, the easier it will be for you to choose between the contributors that apply for your project! Please modify the suggestions below to make them specific for your project.

  • Easy: something that any useR should be able to do, e.g. download some existing package listed in the Related Work, and run it on some example data.
  • Medium: something a bit more complicated. You can encourage contributors to write a script or some functions that show their R coding abilities.
  • Hard: Can the contributor write a package with Rd files, tests, and vignettes? If your package interfaces with non-R code, can the contributor write in that other language?

Solutions of tests

Contributors, please post a link to your test results here.

  • EXAMPLE CONTRIBUTOR 1 NAME, LINK TO GITHUB PROFILE, LINK TO TEST RESULTS.
  1. Aarya Pandey, GitHub Profile, Test Results

Please do not edit this footer! Instead click Edit button in upper right.

Clone this wiki locally