diff --git a/DESCRIPTION b/DESCRIPTION
index 373efc2a..bf4c251a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: AMR
-Version: 1.3.0.9008
+Version: 1.3.0.9009
Date: 2020-08-26
Title: Antimicrobial Resistance Analysis
Authors@R: c(
diff --git a/NEWS.md b/NEWS.md
index 64fb0469..9325353b 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,4 @@
-# AMR 1.3.0.9008
+# AMR 1.3.0.9009
## Last updated: 26 August 2020
### New
@@ -36,9 +36,9 @@
```
* Speed improvement for `eucast_rules()`
* Overall speed improvement by tweaking joining functions
-* Function `mo_shortname()` now return the genus for input where the species is unknown
-* BORSA is now recognised as an abbreviation for a *Staphylococcus aureus*, meaning that e.g. `mo_genus("BORSA")` will return "Staphylococcus"
-* Support for coloured `tibble` printing of classes `mo`, `rsi`, `mic` and `disk`
+* Function `mo_shortname()` now returns the genus for input where the species is unknown
+* BORSA is now recognised as an abbreviation for *Staphylococcus aureus*, meaning that e.g. `mo_genus("BORSA")` will return "Staphylococcus"
+* Support for coloured `tibble` printing of classes `ab`, `mo`, `rsi`, `mic` and `disk`
# AMR 1.3.0
diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R
index 0ffb96c0..9c00ce8c 100755
--- a/R/aa_helper_functions.R
+++ b/R/aa_helper_functions.R
@@ -224,7 +224,7 @@ stop_ifnot_installed <- function(package) {
if (package == "rstudioapi") {
stop("This function only works in RStudio.", call. = FALSE)
} else if (pkg != "base") {
- stop("package '", pkg, "' required but not installed.",
+ stop("This requires the '", pkg, "' package.",
"\nTry to install it with: install.packages(\"", pkg, "\")",
call. = FALSE)
}
@@ -240,7 +240,9 @@ import_fn <- function(name, pkg, error_on_fail = TRUE) {
get(name, envir = asNamespace(pkg)),
error = function(e) {
if (isTRUE(error_on_fail)) {
- stop_("function ", name, "() not found in package '", pkg, "'. Please contact the maintainers of the AMR package at https://github.com/msberends/AMR/issues.", call = FALSE)
+ stop_("function ", name, "() not found in package '", pkg,
+ "'. Please create an issue at https://github.com/msberends/AMR/issues. Many thanks!",
+ call = FALSE)
} else {
return(NULL)
}
diff --git a/R/ab_class_selectors.R b/R/ab_class_selectors.R
index 0d9b723d..001b0cb3 100644
--- a/R/ab_class_selectors.R
+++ b/R/ab_class_selectors.R
@@ -21,15 +21,16 @@
#' Antibiotic class selectors
#'
-#' Use these selection helpers inside any function that allows [Tidyverse selections](https://tidyselect.r-lib.org/reference/language.html), like `dplyr::select()` or `tidyr::pivot_longer()`. They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.
+#' Use these selection helpers inside any function that allows [Tidyverse selection helpers](https://tidyselect.r-lib.org/reference/language.html), like `dplyr::select()` or `tidyr::pivot_longer()`. They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.
#' @inheritParams filter_ab_class
-#' @details All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a selector like e.g. [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
+#' @details All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.) in the [antibiotics] data set. This means that a selector like e.g. [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
#'
-#' These functions only work if the `tidyselect` package is installed, that comes with the `dplyr` package. An error will be thrown if `tidyselect` package is not installed, or if the functions are used outside a function that allows Tidyverse selections like `select()` or `pivot_longer()`.
+#' **N.B. These functions only work if the `tidyselect` package is installed**, that comes with the `dplyr` package. An error will be thrown if the `tidyselect` package is not installed, or if the functions are used outside a function that allows Tidyverse selections like `select()` or `pivot_longer()`.
#' @rdname antibiotic_class_selectors
#' @seealso [filter_ab_class()] for the `filter()` equivalent.
#' @name antibiotic_class_selectors
#' @export
+#' @inheritSection AMR Reference data publicly available
#' @inheritSection AMR Read more on our website!
#' @examples
#' \dontrun{
@@ -58,7 +59,7 @@
#'
#' data.frame(irrelevant = "value",
#' J01CA01 = "S") %>% # ATC code of ampicillin
-#' select(penicillins()) # so the 'J01CA01' column is selected
+#' select(penicillins()) # the 'J01CA01' column will be selected
#'
#' }
ab_class <- function(ab_class) {
diff --git a/R/bug_drug_combinations.R b/R/bug_drug_combinations.R
index 9d3a6253..f287bde3 100644
--- a/R/bug_drug_combinations.R
+++ b/R/bug_drug_combinations.R
@@ -51,7 +51,7 @@
#' FUN = mo_gramstain)
#'
#' x <- bug_drug_combinations(example_isolates,
-#' FUN = function(x) ifelse(x == "B_ESCHR_COLI",
+#' FUN = function(x) ifelse(x == as.mo("E. coli"),
#' "E. coli",
#' "Others"))
#' }
diff --git a/data-raw/antibiotics.dta b/data-raw/antibiotics.dta
index 3f94d906..65a39711 100644
Binary files a/data-raw/antibiotics.dta and b/data-raw/antibiotics.dta differ
diff --git a/data-raw/antibiotics.sas b/data-raw/antibiotics.sas
index a6b66316..22667b8b 100644
Binary files a/data-raw/antibiotics.sas and b/data-raw/antibiotics.sas differ
diff --git a/data-raw/antibiotics.sav b/data-raw/antibiotics.sav
index 5ec52cbd..9ed8bad5 100644
Binary files a/data-raw/antibiotics.sav and b/data-raw/antibiotics.sav differ
diff --git a/data-raw/antibiotics.xlsx b/data-raw/antibiotics.xlsx
index 298927ef..744fbc7b 100644
Binary files a/data-raw/antibiotics.xlsx and b/data-raw/antibiotics.xlsx differ
diff --git a/data-raw/antivirals.dta b/data-raw/antivirals.dta
index 4c4ede05..adfb02c6 100644
Binary files a/data-raw/antivirals.dta and b/data-raw/antivirals.dta differ
diff --git a/data-raw/antivirals.sas b/data-raw/antivirals.sas
index ff8cdd0b..e6dab17d 100644
Binary files a/data-raw/antivirals.sas and b/data-raw/antivirals.sas differ
diff --git a/data-raw/antivirals.sav b/data-raw/antivirals.sav
index 6561d9d2..5a96ebca 100644
Binary files a/data-raw/antivirals.sav and b/data-raw/antivirals.sav differ
diff --git a/data-raw/antivirals.xlsx b/data-raw/antivirals.xlsx
index 58d46c73..eb444e21 100644
Binary files a/data-raw/antivirals.xlsx and b/data-raw/antivirals.xlsx differ
diff --git a/data-raw/intrinsic_resistant.dta b/data-raw/intrinsic_resistant.dta
index 57e639d0..41548e79 100644
Binary files a/data-raw/intrinsic_resistant.dta and b/data-raw/intrinsic_resistant.dta differ
diff --git a/data-raw/intrinsic_resistant.sas b/data-raw/intrinsic_resistant.sas
index b6dbe2ca..0e1782e1 100644
Binary files a/data-raw/intrinsic_resistant.sas and b/data-raw/intrinsic_resistant.sas differ
diff --git a/data-raw/intrinsic_resistant.sav b/data-raw/intrinsic_resistant.sav
index 53fd6664..ab1f33f1 100644
Binary files a/data-raw/intrinsic_resistant.sav and b/data-raw/intrinsic_resistant.sav differ
diff --git a/data-raw/intrinsic_resistant.xlsx b/data-raw/intrinsic_resistant.xlsx
index db36c3c2..4a428bce 100644
Binary files a/data-raw/intrinsic_resistant.xlsx and b/data-raw/intrinsic_resistant.xlsx differ
diff --git a/data-raw/microorganisms.dta b/data-raw/microorganisms.dta
index 1328140a..dea339d5 100644
Binary files a/data-raw/microorganisms.dta and b/data-raw/microorganisms.dta differ
diff --git a/data-raw/microorganisms.old.dta b/data-raw/microorganisms.old.dta
index d1f9430f..0251d0aa 100644
Binary files a/data-raw/microorganisms.old.dta and b/data-raw/microorganisms.old.dta differ
diff --git a/data-raw/microorganisms.old.sas b/data-raw/microorganisms.old.sas
index df1176c1..4f5fbec7 100644
Binary files a/data-raw/microorganisms.old.sas and b/data-raw/microorganisms.old.sas differ
diff --git a/data-raw/microorganisms.old.sav b/data-raw/microorganisms.old.sav
index 8aa0b28f..6d47a322 100644
Binary files a/data-raw/microorganisms.old.sav and b/data-raw/microorganisms.old.sav differ
diff --git a/data-raw/microorganisms.old.xlsx b/data-raw/microorganisms.old.xlsx
index cf0be984..426744d8 100644
Binary files a/data-raw/microorganisms.old.xlsx and b/data-raw/microorganisms.old.xlsx differ
diff --git a/data-raw/microorganisms.sas b/data-raw/microorganisms.sas
index 950fc459..d8c6bc37 100644
Binary files a/data-raw/microorganisms.sas and b/data-raw/microorganisms.sas differ
diff --git a/data-raw/microorganisms.sav b/data-raw/microorganisms.sav
index 3ddd1a2b..0a776bd0 100644
Binary files a/data-raw/microorganisms.sav and b/data-raw/microorganisms.sav differ
diff --git a/data-raw/microorganisms.xlsx b/data-raw/microorganisms.xlsx
index 52511808..96ec1340 100644
Binary files a/data-raw/microorganisms.xlsx and b/data-raw/microorganisms.xlsx differ
diff --git a/data-raw/rsi_translation.dta b/data-raw/rsi_translation.dta
index aafb6513..9b1db516 100644
Binary files a/data-raw/rsi_translation.dta and b/data-raw/rsi_translation.dta differ
diff --git a/data-raw/rsi_translation.sas b/data-raw/rsi_translation.sas
index e760c7ae..59670994 100644
Binary files a/data-raw/rsi_translation.sas and b/data-raw/rsi_translation.sas differ
diff --git a/data-raw/rsi_translation.sav b/data-raw/rsi_translation.sav
index 8f3af7e9..e28c702e 100644
Binary files a/data-raw/rsi_translation.sav and b/data-raw/rsi_translation.sav differ
diff --git a/data-raw/rsi_translation.xlsx b/data-raw/rsi_translation.xlsx
index 6d30b389..b5b52290 100644
Binary files a/data-raw/rsi_translation.xlsx and b/data-raw/rsi_translation.xlsx differ
diff --git a/docs/404.html b/docs/404.html
index ba608dbc..882dab7d 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -81,7 +81,7 @@
NEWS.md
-
Speed improvement for eucast_rules()
Overall speed improvement by tweaking joining functions
Function mo_shortname()
now return the genus for input where the species is unknown
BORSA is now recognised as an abbreviation for a Staphylococcus aureus, meaning that e.g. mo_genus("BORSA")
will return “Staphylococcus”
Support for coloured tibble
printing of classes mo
, rsi
, mic
and disk
Function mo_shortname()
now returns the genus for input where the species is unknown
BORSA is now recognised as an abbreviation for Staphylococcus aureus, meaning that e.g. mo_genus("BORSA")
will return “Staphylococcus”
Support for coloured tibble
printing of classes ab
, mo
, rsi
, mic
and disk
Use these selection helpers inside any function that allows Tidyverse selections, like dplyr::select()
or tidyr::pivot_longer()
. They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.
Use these selection helpers inside any function that allows Tidyverse selection helpers, like dplyr::select()
or tidyr::pivot_longer()
. They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.
ab_class(ab_class) @@ -281,8 +281,13 @@diff --git a/docs/reference/bug_drug_combinations.html b/docs/reference/bug_drug_combinations.html index e100a4d1..90a1a538 100644 --- a/docs/reference/bug_drug_combinations.html +++ b/docs/reference/bug_drug_combinations.html @@ -82,7 +82,7 @@ @@ -353,7 +353,7 @@ The lifecycle of this function is stablemo_gramstain) x <- bug_drug_combinations(example_isolates, - FUN = function(x) ifelse(x == "B_ESCHR_COLI", + FUN = function(x) ifelse(x == as.mo("E. coli"), "E. coli", "Others")) # } diff --git a/docs/reference/index.html b/docs/reference/index.html index be755b35..4d15e24c 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ diff --git a/docs/survey.html b/docs/survey.html index 4d912bd7..cccb70a9 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ diff --git a/man/antibiotic_class_selectors.Rd b/man/antibiotic_class_selectors.Rd index 49e9c0b9..46aca0a4 100644 --- a/man/antibiotic_class_selectors.Rd +++ b/man/antibiotic_class_selectors.Rd @@ -50,13 +50,18 @@ tetracyclines() \item{ab_class}{an antimicrobial class, like \code{"carbapenems"}. The columns \code{group}, \code{atc_group1} and \code{atc_group2} of the \link{antibiotics} data set will be searched (case-insensitive) for this value.} } \description{ -Use these selection helpers inside any function that allows \href{https://tidyselect.r-lib.org/reference/language.html}{Tidyverse selections}, like \code{dplyr::select()} or \code{tidyr::pivot_longer()}. They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. +Use these selection helpers inside any function that allows \href{https://tidyselect.r-lib.org/reference/language.html}{Tidyverse selection helpers}, like \code{dplyr::select()} or \code{tidyr::pivot_longer()}. They help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. } \details{ -All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a selector like e.g. \code{\link[=aminoglycosides]{aminoglycosides()}} will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. +All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.) in the \link{antibiotics} data set. This means that a selector like e.g. \code{\link[=aminoglycosides]{aminoglycosides()}} will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. -These functions only work if the \code{tidyselect} package is installed, that comes with the \code{dplyr} package. An error will be thrown if \code{tidyselect} package is not installed, or if the functions are used outside a function that allows Tidyverse selections like \code{select()} or \code{pivot_longer()}. +\strong{N.B. These functions only work if the \code{tidyselect} package is installed}, that comes with the \code{dplyr} package. An error will be thrown if the \code{tidyselect} package is not installed, or if the functions are used outside a function that allows Tidyverse selections like \code{select()} or \code{pivot_longer()}. } +\section{Reference data publicly available}{ + +All reference data sets (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) in this \code{AMR} package are publicly and freely available. We continually export our data sets to formats for use in R, SPSS, SAS, Stata and Excel. We also supply flat files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please find \href{https://msberends.github.io/AMR/articles/datasets.html}{all download links on our website}, which is automatically updated with every code change. +} + \section{Read more on our website!}{ On our website \url{https://msberends.github.io/AMR} you can find \href{https://msberends.github.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR analysis, the \href{https://msberends.github.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.github.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}. As we would like to better understand the backgrounds and needs of our users, please \href{https://msberends.github.io/AMR/survey.html}{participate in our survey}! @@ -89,7 +94,7 @@ On our website \url{https://msberends.github.io/AMR} you can find \href{https:// data.frame(irrelevant = "value", J01CA01 = "S") \%>\% # ATC code of ampicillin - select(penicillins()) # so the 'J01CA01' column is selected + select(penicillins()) # the 'J01CA01' column will be selected } } diff --git a/man/bug_drug_combinations.Rd b/man/bug_drug_combinations.Rd index b88afd16..5026d8a0 100644 --- a/man/bug_drug_combinations.Rd +++ b/man/bug_drug_combinations.Rd @@ -89,7 +89,7 @@ x <- bug_drug_combinations(example_isolates, FUN = mo_gramstain) x <- bug_drug_combinations(example_isolates, - FUN = function(x) ifelse(x == "B_ESCHR_COLI", + FUN = function(x) ifelse(x == as.mo("E. coli"), "E. coli", "Others")) }Details
-All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a selector like e.g.
-aminoglycosides()
will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.These functions only work if the
+tidyselect
package is installed, that comes with thedplyr
package. An error will be thrown iftidyselect
package is not installed, or if the functions are used outside a function that allows Tidyverse selections likeselect()
orpivot_longer()
.All columns will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.) in the antibiotics data set. This means that a selector like e.g.
+aminoglycosides()
will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.N.B. These functions only work if the
+tidyselect
package is installed, that comes with thedplyr
package. An error will be thrown if thetidyselect
package is not installed, or if the functions are used outside a function that allows Tidyverse selections likeselect()
orpivot_longer()
.Reference data publicly available
+ + + +All reference data sets (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) in this
AMR
package are publicly and freely available. We continually export our data sets to formats for use in R, SPSS, SAS, Stata and Excel. We also supply flat files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please find all download links on our website, which is automatically updated with every code change.Read more on our website!
@@ -319,7 +324,7 @@ data.frame(irrelevant = "value", J01CA01 = "S") %>% # ATC code of ampicillin - select(penicillins()) # so the 'J01CA01' column is selected + select(penicillins()) # the 'J01CA01' column will be selected }