1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 18:01:50 +02:00

(v1.2.0.9008) ab_class improvement

This commit is contained in:
2020-06-17 15:14:37 +02:00
parent c4d7412f36
commit ac12392da3
37 changed files with 619 additions and 362 deletions

View File

@ -190,7 +190,7 @@ Finally, we will apply [EUCAST rules](http://www.eucast.org/expert_rules_and_int
Because the amoxicillin (column `AMX`) and amoxicillin/clavulanic acid (column `AMC`) in our data were generated randomly, some rows will undoubtedly contain AMX = S and AMC = R, which is technically impossible. The `eucast_rules()` fixes this:
```{r eucast, warning = FALSE, message = FALSE}
data <- eucast_rules(data, col_mo = "bacteria")
data <- eucast_rules(data, col_mo = "bacteria", rules = "all")
```
# Adding new variables
@ -332,6 +332,41 @@ data_1st %>%
freq(genus, species, header = TRUE)
```
## Overview of different bug/drug combinations
If you want to get a quick glance of the number of isolates in different bug/drug combinations, you can use the `bug_drug_combinations()` function:
```{r bug_drg 1a, eval = FALSE}
data_1st %>%
bug_drug_combinations() %>%
head() # show first 6 rows
```
```{r bug_drg 1b, echo = FALSE, results = 'asis'}
knitr::kable(data_1st %>%
bug_drug_combinations() %>%
head(),
align = "c")
```
Using [Tidyverse selections](https://tidyselect.r-lib.org/reference/language.html), you can also select columns based on the antibiotic class they are in:
```{r bug_drg 2a, eval = FALSE}
data_1st %>%
select(bacteria, fluoroquinolones()) %>%
bug_drug_combinations()
```
```{r bug_drg 2b, echo = FALSE, results = 'asis'}
knitr::kable(data_1st %>%
select(bacteria, fluoroquinolones()) %>%
bug_drug_combinations(),
align = "c")
```
This will only give you the crude numbers in the data. To calculate antimicrobial resistance, we use the `resistance()` and `susceptibility()` functions.
## Resistance percentages
The functions `resistance()` and `susceptibility()` can be used to calculate antimicrobial resistance or susceptibility. For more specific analyses, the functions `proportion_S()`, `proportion_SI()`, `proportion_I()`, `proportion_IR()` and `proportion_R()` can be used to determine the proportion of a specific antimicrobial outcome.