Learn R Programming

labNorm

labNorm provides functions for normalizing standard laboratory measurements (e.g. hemoglobin, cholesterol levels) according to age and sex. These normalizations are based on the algorithms described in the research paper “Personalized lab test models to quantify disease potentials in healthy individuals”.

This package allows users to easily obtain normalized values for their lab results and to project them on the population distribution. It can use reference distributions from Clalit HMO or UKBB. For more information go to: https://tanaylab.weizmann.ac.il/labs/

Installation

You can install the development version of labNorm from GitHub using the remotes package:

retmotes::install_github("tanaylab/labNorm")

Example

Normalize hemoglobin values for a group of subjects:

library(labNorm)

# Add a column for the normalized values
hemoglobin_data$quantile <- ln_normalize(
    hemoglobin_data$value,
    hemoglobin_data$age,
    hemoglobin_data$sex,
    "Hemoglobin"
)
#> → Downloading to a temporary directory '/tmp/RtmpnrSi5j'.
#> → Extracting data to '/tmp/RtmpnrSi5j'.
#> → Extracting data to '/tmp/RtmpnrSi5j'.
#> ✔ Data downloaded successfully.

head(hemoglobin_data)
#>   age    sex value   quantile
#> 1  20   male  9.39 0.01882213
#> 2  20   male 14.03 0.18674720
#> 3  20   male 14.44 0.27947363
#> 4  20   male 15.80 0.75195053
#> 5  20 female 12.06 0.24249167
#> 6  20 female 12.89 0.57451617

Plot the quantiles vs values for age 50-60:

library(ggplot2)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

hemoglobin_data %>%
    filter(age >= 50 & age <= 60) %>%
    ggplot(aes(x = value, y = quantile, color = sex)) +
    geom_point() +
    theme_classic()

Plot the age/sex distribution of Hemoglobin:

ln_plot_dist("Hemoglobin")

Copy Link

Version

Install

install.packages('labNorm')

Monthly Downloads

212

Version

1.0.1

License

MIT + file LICENSE

Maintainer

Aviezer Lifshitz

Last Published

January 15th, 2023

Functions in labNorm (1.0.1)

ln_download_data

Download high-resolution reference distributions
labNorm-package

labNorm: Normalize Laboratory Measurements by Age and Sex
ln_lab_units

Get available units for a lab
LAB_DETAILS

Available lab names
hemoglobin_data

Example values of Hemoglobin and Creatinine
ln_convert_units

Convert values to the default units for the lab
ln_quantile_value

Compute the lab value for a given quantile
ln_normalize

Normalize lab values to age and sex
ln_plot_dist

Plot age-sex distribution of a lab