comorbidity
comorbidity: An R package for computing comorbidity scores - Published in JOSS (2018)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
2 of 9 committers (22.2%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
comorbidity
r
rstats
Last synced: 6 months ago
·
JSON representation
Repository
An R package for computing comorbidity scores.
Basic Info
- Host: GitHub
- Owner: ellessenne
- License: gpl-3.0
- Language: R
- Default Branch: master
- Homepage: https://ellessenne.github.io/comorbidity/
- Size: 35.4 MB
Statistics
- Stars: 84
- Watchers: 13
- Forks: 22
- Open Issues: 12
- Releases: 4
Topics
comorbidity
r
rstats
Created over 9 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
Changelog
Contributing
License
README.Rmd
---
output: github_document
editor_options:
chunk_output_type: console
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE
)
options(width = 100)
```
# The {comorbidity} Package: Computing Comorbidity Scores in R
Last updated: `r Sys.time()`
[](https://github.com/ellessenne/comorbidity/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/ellessenne/comorbidity?branch=master)
[](https://cran.r-project.org/package=comorbidity)
[](https://cran.r-project.org/package=comorbidity)
[](https://cran.r-project.org/package=comorbidity)
[](https://doi.org/10.21105/joss.00648)
[](https://makeapullrequest.com/)
`comorbidity` is an R package for computing comorbidity scores such as the weighted Charlson score and the Elixhauser comorbidity score; both ICD-10 and ICD-9 coding systems are supported.
## Installation
`comorbidity` is on CRAN. You can install it as usual with:
```{r cran-installation, eval = FALSE}
install.packages("comorbidity")
```
Alternatively, you can install the development version from GitHub with:
```{r gh-installation, eval = FALSE}
# install.packages("remotes")
remotes::install_github("ellessenne/comorbidity")
```
## Simulating ICD-10 codes
The `comorbidity` packages includes a function named `sample_diag()` that allows simulating ICD diagnostic codes in a straightforward way. For instance, we could simulate ICD-10 codes:
```{r simulate-data}
# load the comorbidity package
library(comorbidity)
# set a seed for reproducibility
set.seed(1)
# simulate 50 ICD-10 codes for 5 individuals
x <- data.frame(
id = sample(1:5, size = 50, replace = TRUE),
code = sample_diag(n = 50)
)
x <- x[order(x$id, x$code), ]
print(head(x, n = 15), row.names = FALSE)
```
It is also possible to simulate from two different versions of the ICD-10 coding system. The default is to simulate ICD-10 codes from the 2011 version:
```{r simulate-data-2011}
set.seed(1)
x1 <- data.frame(
id = sample(1:3, size = 30, replace = TRUE),
code = sample_diag(n = 30)
)
set.seed(1)
x2 <- data.frame(
id = sample(1:3, size = 30, replace = TRUE),
code = sample_diag(n = 30, version = "ICD10_2011")
)
# should return TRUE
all.equal(x1, x2)
```
Alternatively, you could use the 2009 version:
```{r simulate-data-2009}
set.seed(1)
x1 <- data.frame(
id = sample(1:3, size = 30, replace = TRUE),
code = sample_diag(n = 30, version = "ICD10_2009")
)
set.seed(1)
x2 <- data.frame(
id = sample(1:3, size = 30, replace = TRUE),
code = sample_diag(n = 30, version = "ICD10_2011")
)
# should not return TRUE
all.equal(x1, x2)
```
## Simulating ICD-9 codes
ICD-9 codes can be easily simulated too:
```{r simulate-data-icd9}
set.seed(2)
x9 <- data.frame(
id = sample(1:3, size = 30, replace = TRUE),
code = sample_diag(n = 30, version = "ICD9_2015")
)
x9 <- x9[order(x9$id, x9$code), ]
print(head(x9, n = 15), row.names = FALSE)
```
## Computing comorbidity scores
The main function of the `comorbidity` package is named `comorbidity()`, and it can be used to compute any supported comorbidity score; scores can be specified by setting the `score` argument, which is required.
Say we have 3 individuals with a total of 30 ICD-10 diagnostic codes:
```{r simulate-data-cs}
set.seed(1)
x <- data.frame(
id = sample(1:3, size = 30, replace = TRUE),
code = sample_diag(n = 30)
)
```
We could compute the Charlson comorbidity domains:
```{r charlson}
charlson <- comorbidity(x = x, id = "id", code = "code", map = "charlson_icd10_quan", assign0 = FALSE)
charlson
```
We set the `assign0` argument to `FALSE` to not apply a hierarchy of comorbidity codes, as described in `?comorbidity::comorbidity`.
Alternatively, we could compute the Elixhauser score:
```{r elixhauser}
elixhauser <- comorbidity(x = x, id = "id", code = "code", map = "elixhauser_icd10_quan", assign0 = FALSE)
elixhauser
```
Weighted an unweighted comorbidity scores can be obtained using the `score()` function:
```{r score}
unw_cci <- score(charlson, weights = NULL, assign0 = FALSE)
unw_cci
quan_cci <- score(charlson, weights = "quan", assign0 = FALSE)
quan_cci
all.equal(unw_cci, quan_cci)
```
Code for the Elixhauser score is omitted, but works analogously.
Conversely, say we have 5 individuals with a total of 100 ICD-9 diagnostic codes:
```{r simulate-data-cs-9}
set.seed(3)
x <- data.frame(
id = sample(1:5, size = 100, replace = TRUE),
code = sample_diag(n = 100, version = "ICD9_2015")
)
```
The Charlson and Elixhauser comorbidity codes can be easily computed once again:
```{r charlson-9}
charlson9 <- comorbidity(x = x, id = "id", code = "code", map = "charlson_icd9_quan", assign0 = FALSE)
charlson9
```
```{r elixhauser-9}
elixhauser9 <- comorbidity(x = x, id = "id", code = "code", map = "elixhauser_icd9_quan", assign0 = FALSE)
elixhauser9
```
Scores:
```{r score-9}
unw_eci <- score(elixhauser9, weights = NULL, assign0 = FALSE)
vw_eci <- score(elixhauser9, weights = "vw", assign0 = FALSE)
all.equal(unw_eci, vw_eci)
```
## Citation
If you find `comorbidity` useful, please cite it in your publications:
```{r citation}
citation("comorbidity")
```
## References
More details on which comorbidity mapping and scoring algorithm are available within the package can be found in the two accompanying vignettes, which can be accessed on CRAN or directly from your R session:
```r
vignette("A-introduction", package = "comorbidity")
vignette("B-comorbidity-scores", package = "comorbidity")
```
The list of available algorithms can be printed interactively using the `available_algorithms()` function:
```{r}
available_algorithms()
```
## Copyright
The icon for the hex sticker was made by Freepik from .
Owner
- Name: Alessandro Gasparini
- Login: ellessenne
- Kind: user
- Location: Stockholm, Sweden
- Company: @RedDoorAnalytics
- Website: https://www.ellessenne.xyz
- Twitter: ellessenne
- Repositories: 9
- Profile: https://github.com/ellessenne
Senior biostatistician, #rstats developer, data aficionado, outdoor enthusiast, pizza fanatic.
JOSS Publication
comorbidity: An R package for computing comorbidity scores
Published
March 30, 2018
Volume 3, Issue 23, Page 648
Authors
Tags
comorbidity scores administrative data epidemiology biostatistics ICDPapers & Mentions
Total mentions: 5
Regional variation of potentially avoidable hospitalisations in Switzerland: an observational study
- DOI: 10.1186/s12913-021-06876-5
- OpenAlex ID: https://openalex.org/W3194310088
- Published: August 2021
Last synced: 4 months ago
Emergency Department-initiated High-flow Nasal Cannula for COVID-19 Respiratory Distress
- DOI: 10.5811/westjem.2021.3.50116
- OpenAlex ID: https://openalex.org/W3186979789
- Published: July 2021
Last synced: 4 months ago
External validation and comparison of two variants of the Elixhauser comorbidity measures for all-cause mortality
- DOI: 10.1371/journal.pone.0174379
- OpenAlex ID: https://openalex.org/W2602171072
- Published: March 2017
Last synced: 4 months ago
Obesity and Mortality, Length of Stay and Hospital Cost among Patients with Sepsis: A Nationwide Inpatient Retrospective Cohort Study
- DOI: 10.1371/journal.pone.0154599
- OpenAlex ID: https://openalex.org/W2342939696
- Published: April 2016
Last synced: 4 months ago
Potentially inappropriate prescribing in older hospitalized Dutch patients according to the STOPP/START criteria v2: a longitudinal study
- DOI: 10.1007/s00228-020-03052-2
- OpenAlex ID: https://openalex.org/W3110020778
- Published: December 2020
Last synced: 4 months ago
GitHub Events
Total
- Issues event: 1
- Watch event: 4
- Issue comment event: 3
- Pull request event: 1
- Fork event: 1
Last Year
- Issues event: 1
- Watch event: 4
- Issue comment event: 3
- Pull request event: 1
- Fork event: 1
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Alessandro Gasparini | g****t@e****z | 345 |
| Alessandro Gasparini | a****5@l****k | 44 |
| Edmund Teo | 3****d | 3 |
| Hojjat Salmasian | s****n | 3 |
| Corinne Riddell | c****l@g****m | 2 |
| Alessandro Gasparini | a****5@l****k | 2 |
| jwilliman | j****n@o****z | 1 |
| axjadamson | 5****n | 1 |
| Desi Quintans | s****e@d****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 57
- Total pull requests: 23
- Average time to close issues: 3 months
- Average time to close pull requests: about 2 months
- Total issue authors: 31
- Total pull request authors: 12
- Average comments per issue: 3.7
- Average comments per pull request: 3.48
- Merged pull requests: 15
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 3
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 2
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ellessenne (16)
- salmasian (5)
- corinne-riddell (3)
- Chris-M-P (3)
- cornflakegrl (2)
- EarlGlynn (2)
- DougDame (1)
- norihikorihiko (1)
- Flora-love-cat (1)
- gp-singh-hub (1)
- julikubz (1)
- janickweberpals (1)
- sk123-ux (1)
- kenkomodo (1)
- jwilliman (1)
Pull Request Authors
- ellessenne (7)
- salmasian (3)
- torema-ed (3)
- DesiQuintans (2)
- fiksdala (2)
- corinne-riddell (2)
- kravvaz (1)
- kenkomodo (1)
- mattmoo (1)
- jwilliman (1)
- axjadamson (1)
- jwallib (1)
Top Labels
Issue Labels
enhancement (7)
bug (4)
discussion (2)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 1,641 last-month
- Total docker downloads: 527
- Total dependent packages: 1
- Total dependent repositories: 2
- Total versions: 16
- Total maintainers: 1
cran.r-project.org: comorbidity
Computing Comorbidity Scores
- Homepage: https://ellessenne.github.io/comorbidity/
- Documentation: http://cran.r-project.org/web/packages/comorbidity/comorbidity.pdf
- License: GPL (≥ 3)
-
Latest release: 1.1.0
published over 1 year ago
Rankings
Forks count: 3.8%
Stargazers count: 5.1%
Downloads: 10.8%
Average: 15.1%
Dependent repos count: 19.2%
Docker downloads count: 23.1%
Dependent packages count: 28.7%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 2.10 depends
- checkmate * imports
- data.table * imports
- stats * imports
- stringi * imports
- utils * imports
- covr * suggests
- knitr * suggests
- rmarkdown * suggests
- testthat * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/cache v2 composite
- actions/checkout v2 composite
- actions/upload-artifact main composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite
.github/workflows/pr-commands.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/pr-fetch v1 composite
- r-lib/actions/pr-push v1 composite
- r-lib/actions/setup-r v1 composite
.github/workflows/test-coverage.yaml
actions
- actions/cache v2 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite
