Skip to content
A collection of R functions to perform basic clinical calculations in medical research.
R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
docs
man
tests
.gitignore
CODE_OF_CONDUCT.md
DESCRIPTION
LICENSE
LICENSE.md
NAMESPACE
NEWS.md
README.md
_pkgdown.yml

README.md

clinicalr: Clinical calculations for R

Lifecycle: experimental CRAN status

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.

Functions

  • Anthropometry
    • Body mass index (BMI, Quetelet index).
    • Body surface area (BSA).
    • Mean arterial blood pressure (MAP).
    • Pulse pressure.
  • Cardiology
    • Corrected QT interval (QTc).
  • Electrolytes
    • Albumin-corrected calcium.
  • Metabolism
    • Presence of the metabolic syndrome.
  • Respiratory medicine
    • CURB-65 community-acquired pneumonia severity score.

Design philosophy

Reliable

  • 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.)

Practical

  • 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.

install.packages("remotes")
remotes::install_github("ls31/clinicalr")

How to update

remotes::install_github("lc31/clinicalr")
You can’t perform that action at this time.