# How to determine multi-drug resistance (MDR) • AMR (for R)

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:

    # 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:

    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:

    head(my_TB_data)
    #   rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin
    # 1          R         S            S          R            S            R
    # 2          R         S            R          S            S            S
    # 3          R         R            R          R            S            R
    # 4          S         S            R          S            R            S
    # 5          R         R            S          I            S            S
    # 6          S         S            R          R            R            S
    #   kanamycin
    # 1         S
    # 2         S
    # 3         S
    # 4         R
    # 5         R
    # 6         S

We can now add the interpretation of MDR-TB to our data set:

    my_TB_data$mdr <- mdr_tb(my_TB_data)
    # NOTE: No column found as input for `col_mo`, assuming all records contain Mycobacterium tuberculosis.
    # Determining multidrug-resistant organisms (MDRO), according to:
    # Guideline: Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis
    # Version:   WHO/HTM/TB/2014.11
    # Author:    WHO (World Health Organization)
    # Source:    https://www.who.int/tb/publications/pmdt_companionhandbook/en/
    # NOTE: Reliability might be improved if these antimicrobial results would be available too: CAP (capreomycin), RIB (rifabutin), RFP (rifapentine)

And review the result with a frequency table:

    freq(my_TB_data$mdr)

Frequency table of `mdr` from `my_TB_data` (5,000 x 8)

Class: factor > ordered (numeric)
Length: 5,000 (of which NA: 0 = 0.00%)
Levels: 5: Negative < Mono-resistance < Poly-resistance < Multidrug resistance…
Unique: 5

| Item | Count | Percent | Cum. Count | Cum. Percent
--- | --- | --- | --- | --- | ---
1 | Mono-resistance | 3,273 | 65.5% | 3,273 | 65.5%
2 | Negative | 687 | 13.7% | 3,960 | 79.2%
3 | Multidrug resistance | 569 | 11.4% | 4,529 | 90.6%
4 | Poly-resistance | 277 | 5.5% | 4,806 | 96.1%
5 | Extensive drug resistance | 194 | 3.9% | 5,000 | 100.0%