mirror of
https://github.com/msberends/AMR.git
synced 2024-12-27 08:06:13 +01:00
86 lines
2.7 KiB
Plaintext
86 lines
2.7 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)
|
|
```
|
|
|
|
We also created a package dedicated to data cleaning and checking, called the `clean` package. It gets automatically installed with the `AMR` package, so we only have to load it:
|
|
|
|
```{r lib clean, message = FALSE}
|
|
library(clean)
|
|
```
|
|
|
|
It contains the `freq()` function, to create a frequency table:
|
|
|
|
```{r, results = 'asis'}
|
|
freq(my_TB_data$mdr)
|
|
```
|