mirror of https://github.com/msberends/AMR.git
80 lines
2.5 KiB
Plaintext
80 lines
2.5 KiB
Plaintext
---
|
|
title: "How to determine multi-drug resistance (MDR)"
|
|
author: "Matthijs S. Berends"
|
|
date: '`r format(Sys.Date(), "%d %B %Y")`'
|
|
output:
|
|
rmarkdown::html_vignette:
|
|
toc: true
|
|
vignette: >
|
|
%\VignetteIndexEntry{How to determine multi-drug resistance (MDR)}
|
|
%\VignetteEncoding{UTF-8}
|
|
%\VignetteEngine{knitr::rmarkdown}
|
|
editor_options:
|
|
chunk_output_type: console
|
|
---
|
|
|
|
```{r setup, include = FALSE, results = 'markup'}
|
|
knitr::opts_chunk$set(
|
|
collapse = TRUE,
|
|
comment = "#"
|
|
)
|
|
library(AMR)
|
|
```
|
|
|
|
With the function `mdro()`, you can determine multi-drug resistant organisms (MDRO). It currently support these guidelines:
|
|
|
|
* "Intrinsic Resistance and Exceptional Phenotypes Tables", by EUCAST (European Committee on Antimicrobial Susceptibility Testing)
|
|
* "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis", by WHO (World Health Organization)
|
|
* "WIP-Richtlijn Bijzonder Resistente Micro-organismen (BRMO)", by RIVM (Rijksinstituut voor de Volksgezondheid, the Netherlands National Institute for Public Health and the Environment)
|
|
|
|
As an example, I will make a data set to determine multi-drug resistant TB:
|
|
|
|
```{r}
|
|
# a helper function to get a random vector with values S, I and R
|
|
# with the probabilities 50%-10%-40%
|
|
sample_rsi <- function() {
|
|
sample(c("S", "I", "R"),
|
|
size = 5000,
|
|
prob = c(0.5, 0.1, 0.4),
|
|
replace = TRUE)
|
|
}
|
|
|
|
my_TB_data <- data.frame(rifampicin = sample_rsi(),
|
|
isoniazid = sample_rsi(),
|
|
gatifloxacin = sample_rsi(),
|
|
ethambutol = sample_rsi(),
|
|
pyrazinamide = sample_rsi(),
|
|
moxifloxacin = sample_rsi(),
|
|
kanamycin = sample_rsi())
|
|
```
|
|
|
|
Because all column names are automatically verified for valid drug names or codes, this would have worked exactly the same:
|
|
|
|
```{r, eval = FALSE}
|
|
my_TB_data <- data.frame(RIF = sample_rsi(),
|
|
INH = sample_rsi(),
|
|
GAT = sample_rsi(),
|
|
ETH = sample_rsi(),
|
|
PZA = sample_rsi(),
|
|
MFX = sample_rsi(),
|
|
KAN = sample_rsi())
|
|
```
|
|
|
|
The data set looks like this now:
|
|
|
|
```{r}
|
|
head(my_TB_data)
|
|
```
|
|
|
|
We can now add the interpretation of MDR-TB to our data set:
|
|
|
|
```{r}
|
|
my_TB_data$mdr <- mdr_tb(my_TB_data)
|
|
```
|
|
|
|
And review the result with a frequency table:
|
|
|
|
```{r}
|
|
freq(my_TB_data$mdr)
|
|
```
|