-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
80 lines (58 loc) · 2.43 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# labNorm <img src="man/figures/logo.png" align="right" height="139" />
<!-- badges: start -->
[![R-CMD-check](https://github.com/tanaylab/labNorm/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tanaylab/labNorm/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/tanaylab/labNorm/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tanaylab/labNorm?branch=main)
![GitHub issues](https://img.shields.io/github/issues/tanaylab/labNorm)
![GitHub R package version](https://img.shields.io/github/r-package/v/tanaylab/labNorm)
[![CRAN status](https://www.r-pkg.org/badges/version/labNorm)](https://CRAN.R-project.org/package=labNorm)
<!-- badges: end -->
`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"](https://doi.org/10.1038/s41591-021-01468-6).
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 `labNorm` from CRAN like so:
``` r
install.packages("labNorm")
```
Or you can install the development version from GitHub using the `remotes` package:
``` r
remotes::install_github("tanaylab/labNorm")
```
## Example
Normalize hemoglobin values for a group of subjects:
```{r}
library(labNorm)
# Add a column for the normalized values
hemoglobin_data$quantile <- ln_normalize(
hemoglobin_data$value,
hemoglobin_data$age,
hemoglobin_data$sex,
"Hemoglobin"
)
head(hemoglobin_data)
```
Plot the quantiles vs values for age 50-60:
```{r}
library(ggplot2)
library(dplyr)
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:
```{r, fig.width=8, fig.height=4}
ln_plot_dist("Hemoglobin")
```