diff --git a/.gitignore b/.gitignore index 28ba0c21..e2371544 100755 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ vignettes/*.R ^CRAN-RELEASE$ packrat/lib*/ packrat/src/ +cran-comments.md diff --git a/DESCRIPTION b/DESCRIPTION index 58450c56..32556885 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 0.6.1.9046 +Version: 0.6.1.9047 Date: 2019-05-31 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/R/zzz.R b/R/zzz.R index 9ccbe71c..9e4f5c87 100755 --- a/R/zzz.R +++ b/R/zzz.R @@ -29,10 +29,6 @@ microorganisms.oldDT$fullname_lower <- tolower(microorganisms.oldDT$fullname) setkey(microorganisms.oldDT, col_id, fullname) - assign(x = "microorganisms", - value = make(), - envir = asNamespace("AMR")) - assign(x = "microorganismsDT", value = make_DT(), envir = asNamespace("AMR")) @@ -55,44 +51,9 @@ } -#' @importFrom dplyr mutate case_when -make <- function() { - AMR::microorganisms %>% - mutate(prevalence = case_when( - class == "Gammaproteobacteria" - | genus %in% c("Enterococcus", "Staphylococcus", "Streptococcus") - | mo == "UNKNOWN" - ~ 1, - phylum %in% c("Proteobacteria", - "Firmicutes", - "Actinobacteria", - "Sarcomastigophora") - | genus %in% c("Aspergillus", - "Bacteroides", - "Candida", - "Capnocytophaga", - "Chryseobacterium", - "Cryptococcus", - "Elisabethkingia", - "Flavobacterium", - "Fusobacterium", - "Giardia", - "Leptotrichia", - "Mycoplasma", - "Prevotella", - "Rhodotorula", - "Treponema", - "Trichophyton", - "Ureaplasma") - | rank %in% c("kingdom", "phylum", "class", "order", "family") - ~ 2, - TRUE ~ 3 - )) -} - #' @importFrom data.table as.data.table setkey make_DT <- function() { - microorganismsDT <- as.data.table(make()) + microorganismsDT <- as.data.table(AMR::microorganisms) microorganismsDT$fullname_lower <- tolower(microorganismsDT$fullname) setkey(microorganismsDT, prevalence, diff --git a/data/microorganisms.rda b/data/microorganisms.rda index 9b828512..a38d14b7 100755 Binary files a/data/microorganisms.rda and b/data/microorganisms.rda differ diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index a0ef0fc6..1e2b543f 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9046 + 0.6.1.9047 diff --git a/docs/articles/index.html b/docs/articles/index.html index 9f01235f..a375e6b7 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9046 + 0.6.1.9047 diff --git a/docs/authors.html b/docs/authors.html index 23a5a4b6..59f824a0 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9046 + 0.6.1.9047 diff --git a/docs/index.html b/docs/index.html index 7df35705..27ab88fd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.6.1.9046 + 0.6.1.9047 diff --git a/docs/news/index.html b/docs/news/index.html index afd0e54e..e4adec12 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.6.1.9046 + 0.6.1.9047 diff --git a/docs/reference/ggplot_rsi.html b/docs/reference/ggplot_rsi.html index 04d99d0f..f316a1e5 100644 --- a/docs/reference/ggplot_rsi.html +++ b/docs/reference/ggplot_rsi.html @@ -80,7 +80,7 @@ AMR (for R) - 0.6.1.9046 + 0.6.1.9047 @@ -485,7 +485,7 @@ nrow = 1, title = "AMR of Top Three Microorganisms In Blood Culture Isolates", subtitle = expression(paste("Only First Isolates, CoNS grouped according to Becker ", italic("et al."), " (2014)")), - x.title = "Antibiotic (Ears-Net code)") + x.title = "Antibiotic (EARS-Net code)") # } diff --git a/reproduction_of_microorganisms.R b/reproduction_of_microorganisms.R index ba2e899c..f2eb82d0 100644 --- a/reproduction_of_microorganisms.R +++ b/reproduction_of_microorganisms.R @@ -452,6 +452,39 @@ MOs <- MOs %>% sum(duplicated(MOs$mo)) colnames(MOs) +# set prevalence per species +MOs <- MOs %>% + mutate(prevalence = case_when( + class == "Gammaproteobacteria" + | genus %in% c("Enterococcus", "Staphylococcus", "Streptococcus") + | mo == "UNKNOWN" + ~ 1, + phylum %in% c("Proteobacteria", + "Firmicutes", + "Actinobacteria", + "Sarcomastigophora") + | genus %in% c("Aspergillus", + "Bacteroides", + "Candida", + "Capnocytophaga", + "Chryseobacterium", + "Cryptococcus", + "Elisabethkingia", + "Flavobacterium", + "Fusobacterium", + "Giardia", + "Leptotrichia", + "Mycoplasma", + "Prevotella", + "Rhodotorula", + "Treponema", + "Trichophyton", + "Ureaplasma") + | rank %in% c("kingdom", "phylum", "class", "order", "family") + ~ 2, + TRUE ~ 3 + )) + # save it MOs <- as.data.frame(MOs %>% arrange(fullname), stringsAsFactors = FALSE) MOs.old <- as.data.frame(MOs.old, stringsAsFactors = FALSE) diff --git a/tests/testthat/test-ggplot_rsi.R b/tests/testthat/test-ggplot_rsi.R index 27465fc9..979d5f31 100644 --- a/tests/testthat/test-ggplot_rsi.R +++ b/tests/testthat/test-ggplot_rsi.R @@ -59,9 +59,6 @@ test_that("ggplot_rsi works", { summarise_all(count_IR) %>% as.double() ) - expect_equal(colnames(getlbls(septic_patients %>% select(AMC, CIP))), - c("Interpretation", "Antibiotic", "Value", "lbl")) - expect_error(ggplot_rsi(septic_patients, fun = "invalid")) expect_error(geom_rsi(septic_patients, fun = "invalid"))