This commit is contained in:
dr. M.S. (Matthijs) Berends 2023-02-18 11:57:17 +01:00
parent e890360986
commit ba255ddb00
15 changed files with 30 additions and 23 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 1.8.2.9133 Version: 1.8.2.9134
Date: 2023-02-17 Date: 2023-02-18
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by data analysis and to work with microbial and antimicrobial properties by

View File

@ -1,4 +1,4 @@
# AMR 1.8.2.9133 # AMR 1.8.2.9134
*(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)* *(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)*

View File

@ -1139,7 +1139,7 @@ try_colour <- function(..., before, after, collapse = " ") {
} }
is_dark <- function() { is_dark <- function() {
if (is.null(AMR_env$is_dark_theme)) { if (is.null(AMR_env$is_dark_theme)) {
AMR_env$is_dark_theme <- tryCatch(isTRUE(getExportedValue("getThemeInfo", ns = asNamespace("rstudioapi"))()$dark), error = function(e) FALSE) !has_colour() || AMR_env$is_dark_theme <- tryCatch(isTRUE(getExportedValue("getThemeInfo", ns = asNamespace("rstudioapi"))()$dark), error = function(e) FALSE)
} }
isTRUE(AMR_env$is_dark_theme) isTRUE(AMR_env$is_dark_theme)
} }

View File

@ -477,7 +477,9 @@ antibiogram <- function(x,
colnames(new_df)[edit_col] <- paste(colnames(new_df)[edit_col], "(N min-max)") colnames(new_df)[edit_col] <- paste(colnames(new_df)[edit_col], "(N min-max)")
} }
structure(as_original_data_class(new_df, class(x), extra_class = "antibiogram"), out <- as_original_data_class(new_df, class(x), extra_class = "antibiogram")
rownames(out) <- NULL
structure(out,
long = long, long = long,
combine_SI = combine_SI combine_SI = combine_SI
) )

View File

@ -164,9 +164,9 @@ bug_drug_combinations <- function(x,
} else { } else {
out <- run_it(x) out <- run_it(x)
} }
rownames(out) <- NULL
out <- out %pm>% pm_arrange(mo, ab) out <- out %pm>% pm_arrange(mo, ab)
out <- as_original_data_class(out, class(x.bak)) # will remove tibble groups out <- as_original_data_class(out, class(x.bak)) # will remove tibble groups
rownames(out) <- NULL
structure(out, class = c("bug_drug_combinations", ifelse(data_has_groups, "grouped", character(0)), class(out))) structure(out, class = c("bug_drug_combinations", ifelse(data_has_groups, "grouped", character(0)), class(out)))
} }

View File

@ -7,7 +7,7 @@
* Integrates with **WHONET**, ATC, **EARS-Net**, PubChem, **LOINC** and **SNOMED CT** * Integrates with **WHONET**, ATC, **EARS-Net**, PubChem, **LOINC** and **SNOMED CT**
* Works on Windows, macOS and Linux with **all versions of R** since R-3.0 and is completely **dependency-free**, highly suitable for places with **limited resources** * Works on Windows, macOS and Linux with **all versions of R** since R-3.0 and is completely **dependency-free**, highly suitable for places with **limited resources**
<div style="display: flex;"> <div style="display: flex; font-size: 0.8em;">
<p style="text-align:left; width: 50%;"><small><a href="https://msberends.github.io/AMR/">https://msberends.github.io/AMR</a></small></p> <p style="text-align:left; width: 50%;"><small><a href="https://msberends.github.io/AMR/">https://msberends.github.io/AMR</a></small></p>
<p style="text-align:right; width: 50%;"><small><a href="https://doi.org/10.18637/jss.v104.i03">https://doi.org/10.18637/jss.v104.i03</a></small></p> <p style="text-align:right; width: 50%;"><small><a href="https://doi.org/10.18637/jss.v104.i03">https://doi.org/10.18637/jss.v104.i03</a></small></p>
</div> </div>

View File

@ -36,7 +36,10 @@
} }
} }
@media (max-width: 575.98px) { @media (max-width: 575.98px) {
footer .pkgdown-footer-right { footer .pkgdown-footer-left {
text-align: center;
}
footer .pkgdown-footer-right {
text-align: center; text-align: center;
} }
} }

View File

@ -1,7 +1,5 @@
--- ---
title: "How to conduct AMR data analysis" title: "How to conduct AMR data analysis"
author: "Dr. Matthijs Berends"
date: '`r format(Sys.Date(), "%d %B %Y")`'
output: output:
rmarkdown::html_vignette: rmarkdown::html_vignette:
toc: true toc: true
@ -18,7 +16,7 @@ editor_options:
knitr::opts_chunk$set( knitr::opts_chunk$set(
warning = FALSE, warning = FALSE,
collapse = TRUE, collapse = TRUE,
comment = "#", comment = "#>",
fig.width = 7.5, fig.width = 7.5,
fig.height = 5 fig.height = 5
) )
@ -586,13 +584,13 @@ autoplot(
The next example uses the `example_isolates` data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practise AMR data analysis. The next example uses the `example_isolates` data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practise AMR data analysis.
We will compare the resistance to amoxicillin/clavulanic acid (column `FOS`) between an ICU and other clinical wards. The input for the `fisher.test()` can be retrieved with a transformation like this: We will compare the resistance to amoxicillin/clavulanic acid (column `AMC`) between an ICU and other clinical wards. The input for the `fisher.test()` can be retrieved with a transformation like this:
```{r, results = 'markup'} ```{r, results = 'markup'}
# use package 'tidyr' to pivot data: # use package 'tidyr' to pivot data:
library(tidyr) library(tidyr)
check_FOS <- example_isolates %>% check_AMC <- example_isolates %>%
filter(ward %in% c("ICU", "Clinical")) %>% # filter on only these wards filter(ward %in% c("ICU", "Clinical")) %>% # filter on only these wards
select(ward, AMC) %>% # select the wards and amoxi/clav select(ward, AMC) %>% # select the wards and amoxi/clav
group_by(ward) %>% # group on the wards group_by(ward) %>% # group on the wards
@ -604,14 +602,18 @@ check_FOS <- example_isolates %>%
select(ICU, Clinical) %>% # and only select these columns select(ICU, Clinical) %>% # and only select these columns
as.matrix() # transform to a good old matrix for fisher.test() as.matrix() # transform to a good old matrix for fisher.test()
check_FOS check_AMC
``` ```
We can apply the test now with: We can apply the test now with:
```{r} ```{r}
# do Fisher's Exact Test # do Fisher's Exact Test
fisher.test(check_FOS) fisher.test(check_AMC)
``` ```
As can be seen, the p value is practically zero (`r format(fisher.test(check_FOS)$p.value, scientific = FALSE)`), which means that the amoxicillin/clavulanic acid resistance found in isolates between patients in ICUs and other clinical wards are really different. As can be seen, the p value is practically zero (`r format(fisher.test(check_AMC)$p.value, scientific = FALSE)`), which means that the amoxicillin/clavulanic acid resistance found in isolates between patients in ICUs and other clinical wards are really different.
----
*Author: Dr. Matthijs Berends*

View File

@ -15,7 +15,7 @@ editor_options:
```{r setup, include = FALSE, results = 'markup'} ```{r setup, include = FALSE, results = 'markup'}
knitr::opts_chunk$set( knitr::opts_chunk$set(
collapse = TRUE, collapse = TRUE,
comment = "#", comment = "#>",
fig.width = 7.5, fig.width = 7.5,
fig.height = 4.5 fig.height = 4.5
) )

View File

@ -14,7 +14,7 @@ editor_options:
```{r setup, include = FALSE, results = 'markup'} ```{r setup, include = FALSE, results = 'markup'}
knitr::opts_chunk$set( knitr::opts_chunk$set(
collapse = TRUE, collapse = TRUE,
comment = "#" comment = "#>"
) )
library(AMR) library(AMR)
``` ```

View File

@ -15,7 +15,7 @@ editor_options:
```{r setup, include = FALSE, results = 'markup'} ```{r setup, include = FALSE, results = 'markup'}
knitr::opts_chunk$set( knitr::opts_chunk$set(
collapse = TRUE, collapse = TRUE,
comment = "#", comment = "#>",
fig.width = 7.5, fig.width = 7.5,
fig.height = 4.5, fig.height = 4.5,
dpi = 100 dpi = 100

View File

@ -16,7 +16,7 @@ editor_options:
```{r setup, include = FALSE, results = 'markup'} ```{r setup, include = FALSE, results = 'markup'}
knitr::opts_chunk$set( knitr::opts_chunk$set(
collapse = TRUE, collapse = TRUE,
comment = "#" comment = "#>"
) )
# set to original language (English) # set to original language (English)
Sys.setlocale(locale = "C") Sys.setlocale(locale = "C")

View File

@ -15,7 +15,7 @@ editor_options:
```{r setup, include = FALSE, results = 'markup'} ```{r setup, include = FALSE, results = 'markup'}
knitr::opts_chunk$set( knitr::opts_chunk$set(
collapse = TRUE, collapse = TRUE,
comment = "#", comment = "#>",
fig.width = 7.5, fig.width = 7.5,
fig.height = 4.5 fig.height = 4.5
) )

View File

@ -14,7 +14,7 @@ editor_options:
```{r setup, include = FALSE, results = 'markup'} ```{r setup, include = FALSE, results = 'markup'}
knitr::opts_chunk$set( knitr::opts_chunk$set(
collapse = TRUE, collapse = TRUE,
comment = "#", comment = "#>",
fig.width = 7.5, fig.width = 7.5,
fig.height = 4.75 fig.height = 4.75
) )

View File

@ -16,7 +16,7 @@ editor_options:
knitr::opts_chunk$set( knitr::opts_chunk$set(
warning = FALSE, warning = FALSE,
collapse = TRUE, collapse = TRUE,
comment = "#", comment = "#>",
fig.width = 7.5, fig.width = 7.5,
fig.height = 5 fig.height = 5
) )