clinicalr: Clinical calculations for R
The clinicalr package is a collection of R functions to perform (basic) clinical calculations in medical research. User documentation can be found on GitHub.io.
Help and pull requests are more than welcome.
- Body mass index (BMI, Quetelet index).
- Body surface area (BSA).
- Mean arterial blood pressure (MAP).
- Pulse pressure.
- Corrected QT interval (QTc).
- Albumin-corrected calcium.
- Presence of the metabolic syndrome.
- Respiratory medicine
- CURB-65 community-acquired pneumonia severity score.
- Explicit units for output
- Numeric output of a function will have a specified unit attribute (if applicable) using the units package.
- Fail-fast without assumptions
- If certain conditions are not explicitly provided, err on the side of caution (e.g. a fasting state has to be provided in order for a glucose to be considered a fasting glucose).
- Explicit references and caveats
- Every function will have references and a section on caveats. (However, despite our best efforts of quality control, the functions are provided as-is, without any guarantees, and users would be wise to check the output for quality and accuracy in their use case.)
- Input using units by expected use case
- Units used in the functions can be inconsistent (m versus cm, s versus ms) on purpose to best suit the most common usage of certain formulae.
- Single entry functions if possible
- If multiple methods or formulae are known for the same phenomenon (e.g. body surface are), a single function is provided and the specific method can be specified as an argument. A default method is specified, if possible. This approach is not used if the parameters for functions differ.
Practical notes on the use of the unit attribute
If applicable, functions will return numeric values with a unit attribute using the units package. This is to be as explicit as possible to the end user about the generated data. However, the unit attributes may sometimes be bothersome. Use
units::drop_units(x) to drop the unit attribute. Load the ggforce package (an extension of ggplot) if you want to incorporate the unit attribute in the scales of a ggplot figure (see ggforce reference page Position scales for units data).
How to install
Clinicalr is not (yet) available on CRAN. Install devtools. Then use devtools to install clinicalr directly from GitHub using the remotes package.
How to update