mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 06:06:12 +01:00
(v2.1.1.9116) selectors as separate functions
This commit is contained in:
parent
e231352617
commit
175a6777f3
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.1.1.9112
|
Version: 2.1.1.9116
|
||||||
Date: 2024-12-06
|
Date: 2024-12-13
|
||||||
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
|
||||||
|
6
NEWS.md
6
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 2.1.1.9112
|
# AMR 2.1.1.9116
|
||||||
|
|
||||||
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*
|
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*
|
||||||
|
|
||||||
@ -47,7 +47,8 @@ This package now supports not only tools for AMR data analysis in clinical setti
|
|||||||
* Added Amorolfine (`AMO`, D01AE16), which is now also part of the `antifungals()` selector
|
* Added Amorolfine (`AMO`, D01AE16), which is now also part of the `antifungals()` selector
|
||||||
* Antibiotic selectors
|
* Antibiotic selectors
|
||||||
* Added selectors `nitrofurans()` and `rifamycins()`
|
* Added selectors `nitrofurans()` and `rifamycins()`
|
||||||
* When using antibiotic selectors such as `aminoglycosides()` that exclude non-treatable drugs like gentamicin-high, the function now always returns a warning that these can be included using `only_treatable = FALSE`
|
* When using antibiotic selectors (such as `aminoglycosides()`) that exclude non-treatable drugs (such as gentamicin-high), the function now always returns a warning that these can be included using `only_treatable = FALSE`
|
||||||
|
* All selectors can now be run as a separate command to retrieve a vector of all possible antimicrobials that the selector can select
|
||||||
* MICs
|
* MICs
|
||||||
* Added as valid levels: 4096, 6 powers of 0.0625, and 5 powers of 192 (192, 384, 576, 768, 960)
|
* Added as valid levels: 4096, 6 powers of 0.0625, and 5 powers of 192 (192, 384, 576, 768, 960)
|
||||||
* Added new argument `keep_operators` to `as.mic()`. This can be `"all"` (default), `"none"`, or `"edges"`. This argument is also available in the new `rescale_mic()` and `scale_*_mic()` functions.
|
* Added new argument `keep_operators` to `as.mic()`. This can be `"all"` (default), `"none"`, or `"edges"`. This argument is also available in the new `rescale_mic()` and `scale_*_mic()` functions.
|
||||||
@ -71,6 +72,7 @@ This package now supports not only tools for AMR data analysis in clinical setti
|
|||||||
* Fixed a bug for `sir_confidence_interval()` when there are no isolates available
|
* Fixed a bug for `sir_confidence_interval()` when there are no isolates available
|
||||||
* Updated the prevalence calculation to include genera from the World Health Organization's (WHO) Priority Pathogen List
|
* Updated the prevalence calculation to include genera from the World Health Organization's (WHO) Priority Pathogen List
|
||||||
* Improved algorithm of `first_isolate()` when using the phenotype-based method, to prioritise records with the highest availability of SIR values
|
* Improved algorithm of `first_isolate()` when using the phenotype-based method, to prioritise records with the highest availability of SIR values
|
||||||
|
* `scale_y_percent()` can now cope with ranges outside the 0-100% range
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
* Greatly improved `vctrs` integration, a Tidyverse package working in the background for many Tidyverse functions. For users, this means that functions such as `dplyr`'s `bind_rows()`, `rowwise()` and `c_across()` are now supported for e.g. columns of class `mic`. Despite this, this `AMR` package is still zero-dependent on any other package, including `dplyr` and `vctrs`.
|
* Greatly improved `vctrs` integration, a Tidyverse package working in the background for many Tidyverse functions. For users, this means that functions such as `dplyr`'s `bind_rows()`, `rowwise()` and `c_across()` are now supported for e.g. columns of class `mic`. Despite this, this `AMR` package is still zero-dependent on any other package, including `dplyr` and `vctrs`.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Metadata-Version: 2.1
|
Metadata-Version: 2.1
|
||||||
Name: AMR
|
Name: AMR
|
||||||
Version: 2.1.1.9112
|
Version: 2.1.1.9116
|
||||||
Summary: A Python wrapper for the AMR R package
|
Summary: A Python wrapper for the AMR R package
|
||||||
Home-page: https://github.com/msberends/AMR
|
Home-page: https://github.com/msberends/AMR
|
||||||
Author: Dr. Matthijs Berends
|
Author: Dr. Matthijs Berends
|
||||||
|
Binary file not shown.
BIN
PythonPackage/AMR/dist/amr-2.1.1.9112.tar.gz
vendored
BIN
PythonPackage/AMR/dist/amr-2.1.1.9112.tar.gz
vendored
Binary file not shown.
BIN
PythonPackage/AMR/dist/amr-2.1.1.9116.tar.gz
vendored
Normal file
BIN
PythonPackage/AMR/dist/amr-2.1.1.9116.tar.gz
vendored
Normal file
Binary file not shown.
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='AMR',
|
name='AMR',
|
||||||
version='2.1.1.9112',
|
version='2.1.1.9116',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'rpy2',
|
'rpy2',
|
||||||
|
@ -1036,6 +1036,7 @@ get_current_data <- function(arg_name, call) {
|
|||||||
", e.g.:\n",
|
", e.g.:\n",
|
||||||
" ", AMR_env$bullet_icon, " your_data %>% select(", fn, "())\n",
|
" ", AMR_env$bullet_icon, " your_data %>% select(", fn, "())\n",
|
||||||
" ", AMR_env$bullet_icon, " your_data %>% select(column_a, column_b, ", fn, "())\n",
|
" ", AMR_env$bullet_icon, " your_data %>% select(column_a, column_b, ", fn, "())\n",
|
||||||
|
" ", AMR_env$bullet_icon, " your_data %>% filter(any(", fn, "() == \"R\"))\n",
|
||||||
" ", AMR_env$bullet_icon, " your_data[, ", fn, "()]\n",
|
" ", AMR_env$bullet_icon, " your_data[, ", fn, "()]\n",
|
||||||
" ", AMR_env$bullet_icon, " your_data[, c(\"column_a\", \"column_b\", ", fn, "())]"
|
" ", AMR_env$bullet_icon, " your_data[, c(\"column_a\", \"column_b\", ", fn, "())]"
|
||||||
)
|
)
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
#' `r paste0(" * ", na.omit(sapply(DEFINED_AB_GROUPS, function(ab) ifelse(tolower(gsub("^AB_", "", ab)) %in% ls(envir = asNamespace("AMR")), paste0("[", tolower(gsub("^AB_", "", ab)), "()] can select: \\cr ", vector_and(paste0(ab_name(eval(parse(text = ab), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), " (", eval(parse(text = ab), envir = asNamespace("AMR")), ")"), quotes = FALSE, sort = TRUE)), character(0)), USE.NAMES = FALSE)), "\n", collapse = "")`
|
#' `r paste0(" * ", na.omit(sapply(DEFINED_AB_GROUPS, function(ab) ifelse(tolower(gsub("^AB_", "", ab)) %in% ls(envir = asNamespace("AMR")), paste0("[", tolower(gsub("^AB_", "", ab)), "()] can select: \\cr ", vector_and(paste0(ab_name(eval(parse(text = ab), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), " (", eval(parse(text = ab), envir = asNamespace("AMR")), ")"), quotes = FALSE, sort = TRUE)), character(0)), USE.NAMES = FALSE)), "\n", collapse = "")`
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @name antibiotic_class_selectors
|
#' @name antibiotic_class_selectors
|
||||||
#' @return (internally) a [character] vector of column names, with additional class `"ab_selector"`
|
#' @return When used inside selecting or filtering, this returns a [character] vector of column names, with additional class `"ab_selector"`. When used individually, this returns an ['ab' vector][as.ab()] with all possible antimicrobial that the function would be able to select or filter.
|
||||||
#' @export
|
#' @export
|
||||||
#' @inheritSection AMR Reference Data Publicly Available
|
#' @inheritSection AMR Reference Data Publicly Available
|
||||||
#' @examples
|
#' @examples
|
||||||
@ -57,9 +57,15 @@
|
|||||||
#' example_isolates
|
#' example_isolates
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
|
#' # you can use the selectors separately to retrieve all possible antimicrobials:
|
||||||
|
#' carbapenems()
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' # Though they are primarily intended to use for selections and filters.
|
||||||
#' # Examples sections below are split into 'dplyr', 'base R', and 'data.table':
|
#' # Examples sections below are split into 'dplyr', 'base R', and 'data.table':
|
||||||
#'
|
#'
|
||||||
#' \donttest{
|
#' \donttest{
|
||||||
|
#' \dontrun{
|
||||||
#' # dplyr -------------------------------------------------------------------
|
#' # dplyr -------------------------------------------------------------------
|
||||||
#'
|
#'
|
||||||
#' library(dplyr, warn.conflicts = FALSE)
|
#' library(dplyr, warn.conflicts = FALSE)
|
||||||
@ -145,7 +151,7 @@
|
|||||||
#' z <- example_isolates %>% filter(if_all(carbapenems(), ~ .x == "R"))
|
#' z <- example_isolates %>% filter(if_all(carbapenems(), ~ .x == "R"))
|
||||||
#' identical(x, y) && identical(y, z)
|
#' identical(x, y) && identical(y, z)
|
||||||
#'
|
#'
|
||||||
#'
|
#' }
|
||||||
#' # base R ------------------------------------------------------------------
|
#' # base R ------------------------------------------------------------------
|
||||||
#'
|
#'
|
||||||
#' # select columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
#' # select columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
||||||
@ -589,15 +595,16 @@ ab_select_exec <- function(function_name,
|
|||||||
ab_class_args = NULL) {
|
ab_class_args = NULL) {
|
||||||
# get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call
|
# get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call
|
||||||
# it only takes a couple of milliseconds, so no problem
|
# it only takes a couple of milliseconds, so no problem
|
||||||
vars_df <- get_current_data(arg_name = NA, call = -3)
|
vars_df <- tryCatch(get_current_data(arg_name = NA, call = -3), error = function(e) NULL)
|
||||||
# to improve speed, get_column_abx() will only run once when e.g. in a select or group call
|
# to improve speed, get_column_abx() will only run once when e.g. in a select or group call
|
||||||
|
if (!is.null(vars_df)) {
|
||||||
ab_in_data <- get_column_abx(vars_df,
|
ab_in_data <- get_column_abx(vars_df,
|
||||||
info = FALSE, only_sir_columns = only_sir_columns,
|
info = FALSE, only_sir_columns = only_sir_columns,
|
||||||
sort = FALSE, fn = function_name
|
sort = FALSE, fn = function_name)
|
||||||
)
|
}
|
||||||
|
|
||||||
# untreatable drugs
|
# untreatable drugs
|
||||||
if (only_treatable == TRUE) {
|
if (!is.null(vars_df) && only_treatable == TRUE) {
|
||||||
untreatable <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$name %like% "(-high|EDTA|polysorbate|macromethod|screening|nacubactam)"), "ab", drop = TRUE]
|
untreatable <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$name %like% "(-high|EDTA|polysorbate|macromethod|screening|nacubactam)"), "ab", drop = TRUE]
|
||||||
if (any(untreatable %in% names(ab_in_data))) {
|
if (any(untreatable %in% names(ab_in_data))) {
|
||||||
if (message_not_thrown_before(function_name, "ab_class", "untreatable")) {
|
if (message_not_thrown_before(function_name, "ab_class", "untreatable")) {
|
||||||
@ -617,7 +624,7 @@ ab_select_exec <- function(function_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length(ab_in_data) == 0) {
|
if (!is.null(vars_df) && length(ab_in_data) == 0) {
|
||||||
message_("No antimicrobial drugs found in the data.")
|
message_("No antimicrobial drugs found in the data.")
|
||||||
return(NULL)
|
return(NULL)
|
||||||
}
|
}
|
||||||
@ -667,6 +674,21 @@ ab_select_exec <- function(function_name,
|
|||||||
examples <- paste0(" (such as ", find_ab_names(ab_class_args, 2), ")")
|
examples <- paste0(" (such as ", find_ab_names(ab_class_args, 2), ")")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is.null(vars_df)) {
|
||||||
|
# no data found, no antimicrobials, so no input. Can happen if users run e.g. `aminoglycosides()` as a separate command.
|
||||||
|
examples <- paste0(
|
||||||
|
", e.g.:\n",
|
||||||
|
" ", AMR_env$bullet_icon, " your_data %>% select(", function_name, "())\n",
|
||||||
|
" ", AMR_env$bullet_icon, " your_data %>% select(column_a, column_b, ", function_name, "())\n",
|
||||||
|
" ", AMR_env$bullet_icon, " your_data %>% filter(any(", function_name, "() == \"R\"))\n",
|
||||||
|
" ", AMR_env$bullet_icon, " your_data[, ", function_name, "()]\n",
|
||||||
|
" ", AMR_env$bullet_icon, " your_data[, c(\"column_a\", \"column_b\", ", function_name, "())]"
|
||||||
|
)
|
||||||
|
message_("The function `" , function_name, "()` should be used inside a `dplyr` verb or `data.frame` call",
|
||||||
|
examples, "\n\nNow returning a vector of all possible antimicrobials that `" , function_name, "()` can select.")
|
||||||
|
return(sort(abx))
|
||||||
|
}
|
||||||
|
|
||||||
# get the columns with a group names in the chosen ab class
|
# get the columns with a group names in the chosen ab class
|
||||||
agents <- ab_in_data[names(ab_in_data) %in% abx]
|
agents <- ab_in_data[names(ab_in_data) %in% abx]
|
||||||
|
|
||||||
|
@ -373,17 +373,17 @@ facet_sir <- function(facet = c("interpretation", "antibiotic"), nrow = NULL) {
|
|||||||
|
|
||||||
#' @rdname ggplot_sir
|
#' @rdname ggplot_sir
|
||||||
#' @export
|
#' @export
|
||||||
scale_y_percent <- function(breaks = seq(0, 1, 0.1), limits = NULL) {
|
scale_y_percent <- function(breaks = function(x) seq(0, max(x, na.rm = TRUE), 0.1), limits = NULL) {
|
||||||
stop_ifnot_installed("ggplot2")
|
stop_ifnot_installed("ggplot2")
|
||||||
meet_criteria(breaks, allow_class = c("numeric", "integer"))
|
meet_criteria(breaks, allow_class = c("numeric", "integer", "function"))
|
||||||
meet_criteria(limits, allow_class = c("numeric", "integer"), has_length = 2, allow_NULL = TRUE, allow_NA = TRUE)
|
meet_criteria(limits, allow_class = c("numeric", "integer"), has_length = 2, allow_NULL = TRUE, allow_NA = TRUE)
|
||||||
|
|
||||||
if (all(breaks[breaks != 0] > 1)) {
|
if (!is.function(breaks) && all(breaks[breaks != 0] > 1)) {
|
||||||
breaks <- breaks / 100
|
breaks <- breaks / 100
|
||||||
}
|
}
|
||||||
ggplot2::scale_y_continuous(
|
ggplot2::scale_y_continuous(
|
||||||
breaks = breaks,
|
breaks = breaks,
|
||||||
labels = percentage(breaks),
|
labels = if (is.function(breaks)) function(x) percentage(breaks(x)) else percentage(breaks),
|
||||||
limits = limits
|
limits = limits
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
This files contains all context you must know about the AMR package for R.
|
This files contains all context you must know about the AMR package for R.
|
||||||
First and foremost, you are trained on version 2.1.1.9112. Remember this whenever someone asks which AMR package version you’re at.
|
First and foremost, you are trained on version 2.1.1.9116. Remember this whenever someone asks which AMR package version you’re at.
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'NAMESPACE':
|
THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'NAMESPACE':
|
||||||
@ -811,29 +811,29 @@ Authors:
|
|||||||
|
|
||||||
Other contributors:
|
Other contributors:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item Casper J. Albers (\href{https://orcid.org/0000-0002-9213-6743}{ORCID}) [thesis advisor]
|
\item Andrew P. Norgan (\href{https://orcid.org/0000-0002-2955-2066}{ORCID}) [contributor]
|
||||||
\item Larisse Bolton (\href{https://orcid.org/0000-0001-7879-2173}{ORCID}) [contributor]
|
\item Anita Williams (\href{https://orcid.org/0000-0002-5295-8451}{ORCID}) [contributor]
|
||||||
\item Peter Dutey-Magni (\href{https://orcid.org/0000-0002-8942-9836}{ORCID}) [contributor]
|
\item Annick Lenglet (\href{https://orcid.org/0000-0003-2013-8405}{ORCID}) [contributor]
|
||||||
\item Judith M. Fonville [contributor]
|
\item Anthony Underwood (\href{https://orcid.org/0000-0002-8547-4277}{ORCID}) [contributor]
|
||||||
\item Alex W. Friedrich (\href{https://orcid.org/0000-0003-4881-038X}{ORCID}) [thesis advisor]
|
\item Anton Mymrikov [contributor]
|
||||||
\item Corinna Glasner (\href{https://orcid.org/0000-0003-1241-1328}{ORCID}) [thesis advisor]
|
\item Bart C. Meijer [contributor]
|
||||||
|
\item Christian F. Luz (\href{https://orcid.org/0000-0001-5809-5995}{ORCID}) [contributor]
|
||||||
|
\item Dmytro Mykhailenko [contributor]
|
||||||
\item Eric H. L. C. M. Hazenberg [contributor]
|
\item Eric H. L. C. M. Hazenberg [contributor]
|
||||||
\item Gwen Knight (\href{https://orcid.org/0000-0002-7263-9896}{ORCID}) [contributor]
|
\item Gwen Knight (\href{https://orcid.org/0000-0002-7263-9896}{ORCID}) [contributor]
|
||||||
\item Annick Lenglet (\href{https://orcid.org/0000-0003-2013-8405}{ORCID}) [contributor]
|
|
||||||
\item Christian F. Luz (\href{https://orcid.org/0000-0001-5809-5995}{ORCID}) [contributor]
|
|
||||||
\item Bart C. Meijer [contributor]
|
|
||||||
\item Dmytro Mykhailenko [contributor]
|
|
||||||
\item Anton Mymrikov [contributor]
|
|
||||||
\item Andrew P. Norgan (\href{https://orcid.org/0000-0002-2955-2066}{ORCID}) [contributor]
|
|
||||||
\item Sofia Ny (\href{https://orcid.org/0000-0002-2017-1363}{ORCID}) [contributor]
|
|
||||||
\item Matthew Saab [contributor]
|
|
||||||
\item Jonas Salm [contributor]
|
|
||||||
\item Javier Sanchez (\href{https://orcid.org/0000-0003-2605-8094}{ORCID}) [contributor]
|
|
||||||
\item Rogier P. Schade [contributor]
|
|
||||||
\item Bhanu N. M. Sinha (\href{https://orcid.org/0000-0003-1634-0010}{ORCID}) [thesis advisor]
|
|
||||||
\item Jason Stull (\href{https://orcid.org/0000-0002-9028-8153}{ORCID}) [contributor]
|
\item Jason Stull (\href{https://orcid.org/0000-0002-9028-8153}{ORCID}) [contributor]
|
||||||
\item Anthony Underwood (\href{https://orcid.org/0000-0002-8547-4277}{ORCID}) [contributor]
|
\item Javier Sanchez (\href{https://orcid.org/0000-0003-2605-8094}{ORCID}) [contributor]
|
||||||
\item Anita Williams (\href{https://orcid.org/0000-0002-5295-8451}{ORCID}) [contributor]
|
\item Jonas Salm [contributor]
|
||||||
|
\item Judith M. Fonville [contributor]
|
||||||
|
\item Larisse Bolton (\href{https://orcid.org/0000-0001-7879-2173}{ORCID}) [contributor]
|
||||||
|
\item Matthew Saab [contributor]
|
||||||
|
\item Peter Dutey-Magni (\href{https://orcid.org/0000-0002-8942-9836}{ORCID}) [contributor]
|
||||||
|
\item Rogier P. Schade [contributor]
|
||||||
|
\item Sofia Ny (\href{https://orcid.org/0000-0002-2017-1363}{ORCID}) [contributor]
|
||||||
|
\item Alex W. Friedrich (\href{https://orcid.org/0000-0003-4881-038X}{ORCID}) [thesis advisor]
|
||||||
|
\item Bhanu N. M. Sinha (\href{https://orcid.org/0000-0003-1634-0010}{ORCID}) [thesis advisor]
|
||||||
|
\item Casper J. Albers (\href{https://orcid.org/0000-0002-9213-6743}{ORCID}) [thesis advisor]
|
||||||
|
\item Corinna Glasner (\href{https://orcid.org/0000-0003-1241-1328}{ORCID}) [thesis advisor]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2051,7 +2051,7 @@ not_intrinsic_resistant(
|
|||||||
\item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be "3.3", "3.2", or "3.1".}
|
\item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be "3.3", "3.2", or "3.1".}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
(internally) a \link{character} vector of column names, with additional class \code{"ab_selector"}
|
When used inside selecting or filtering, this returns a \link{character} vector of column names, with additional class \code{"ab_selector"}. When used individually, this returns an \link[=as.ab]{'ab' vector} with all possible antimicrobial that the function would be able to select or filter.
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class or group (according to the \link{antibiotics} data set), without the need to define the columns or antibiotic abbreviations.
|
These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class or group (according to the \link{antibiotics} data set), without the need to define the columns or antibiotic abbreviations.
|
||||||
@ -2116,9 +2116,15 @@ All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR
|
|||||||
example_isolates
|
example_isolates
|
||||||
|
|
||||||
|
|
||||||
|
# you can use the selectors separately to retrieve all possible antimicrobials:
|
||||||
|
carbapenems()
|
||||||
|
|
||||||
|
|
||||||
|
# Though they are primarily intended to use for selections and filters.
|
||||||
# Examples sections below are split into 'dplyr', 'base R', and 'data.table':
|
# Examples sections below are split into 'dplyr', 'base R', and 'data.table':
|
||||||
|
|
||||||
\donttest{
|
\donttest{
|
||||||
|
\dontrun{
|
||||||
# dplyr -------------------------------------------------------------------
|
# dplyr -------------------------------------------------------------------
|
||||||
|
|
||||||
library(dplyr, warn.conflicts = FALSE)
|
library(dplyr, warn.conflicts = FALSE)
|
||||||
@ -2204,7 +2210,7 @@ y <- example_isolates \%>\% filter(carbapenems() == "R")
|
|||||||
z <- example_isolates \%>\% filter(if_all(carbapenems(), ~ .x == "R"))
|
z <- example_isolates \%>\% filter(if_all(carbapenems(), ~ .x == "R"))
|
||||||
identical(x, y) && identical(y, z)
|
identical(x, y) && identical(y, z)
|
||||||
|
|
||||||
|
}
|
||||||
# base R ------------------------------------------------------------------
|
# base R ------------------------------------------------------------------
|
||||||
|
|
||||||
# select columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
# select columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
||||||
@ -5405,7 +5411,10 @@ geom_sir(
|
|||||||
|
|
||||||
facet_sir(facet = c("interpretation", "antibiotic"), nrow = NULL)
|
facet_sir(facet = c("interpretation", "antibiotic"), nrow = NULL)
|
||||||
|
|
||||||
scale_y_percent(breaks = seq(0, 1, 0.1), limits = NULL)
|
scale_y_percent(
|
||||||
|
breaks = function(x) seq(0, max(x, na.rm = TRUE), 0.1),
|
||||||
|
limits = NULL
|
||||||
|
)
|
||||||
|
|
||||||
scale_sir_colours(..., aesthetics = "fill")
|
scale_sir_colours(..., aesthetics = "fill")
|
||||||
|
|
@ -53,6 +53,9 @@ expect_equal(ncol(example_isolates[, tetracyclines(), drop = FALSE]), 3, toleran
|
|||||||
expect_equal(ncol(example_isolates[, trimethoprims(), drop = FALSE]), 2, tolerance = 0.5)
|
expect_equal(ncol(example_isolates[, trimethoprims(), drop = FALSE]), 2, tolerance = 0.5)
|
||||||
expect_equal(ncol(example_isolates[, ureidopenicillins(), drop = FALSE]), 1, tolerance = 0.5)
|
expect_equal(ncol(example_isolates[, ureidopenicillins(), drop = FALSE]), 1, tolerance = 0.5)
|
||||||
|
|
||||||
|
expect_message(carbapenems())
|
||||||
|
expect_error(administrable_per_os())
|
||||||
|
|
||||||
# Examples:
|
# Examples:
|
||||||
|
|
||||||
# select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
|
# select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
|
||||||
|
40
man/AMR.Rd
40
man/AMR.Rd
@ -61,29 +61,29 @@ Authors:
|
|||||||
|
|
||||||
Other contributors:
|
Other contributors:
|
||||||
\itemize{
|
\itemize{
|
||||||
\item Casper J. Albers (\href{https://orcid.org/0000-0002-9213-6743}{ORCID}) [thesis advisor]
|
\item Andrew P. Norgan (\href{https://orcid.org/0000-0002-2955-2066}{ORCID}) [contributor]
|
||||||
\item Larisse Bolton (\href{https://orcid.org/0000-0001-7879-2173}{ORCID}) [contributor]
|
\item Anita Williams (\href{https://orcid.org/0000-0002-5295-8451}{ORCID}) [contributor]
|
||||||
\item Peter Dutey-Magni (\href{https://orcid.org/0000-0002-8942-9836}{ORCID}) [contributor]
|
\item Annick Lenglet (\href{https://orcid.org/0000-0003-2013-8405}{ORCID}) [contributor]
|
||||||
\item Judith M. Fonville [contributor]
|
\item Anthony Underwood (\href{https://orcid.org/0000-0002-8547-4277}{ORCID}) [contributor]
|
||||||
\item Alex W. Friedrich (\href{https://orcid.org/0000-0003-4881-038X}{ORCID}) [thesis advisor]
|
\item Anton Mymrikov [contributor]
|
||||||
\item Corinna Glasner (\href{https://orcid.org/0000-0003-1241-1328}{ORCID}) [thesis advisor]
|
\item Bart C. Meijer [contributor]
|
||||||
|
\item Christian F. Luz (\href{https://orcid.org/0000-0001-5809-5995}{ORCID}) [contributor]
|
||||||
|
\item Dmytro Mykhailenko [contributor]
|
||||||
\item Eric H. L. C. M. Hazenberg [contributor]
|
\item Eric H. L. C. M. Hazenberg [contributor]
|
||||||
\item Gwen Knight (\href{https://orcid.org/0000-0002-7263-9896}{ORCID}) [contributor]
|
\item Gwen Knight (\href{https://orcid.org/0000-0002-7263-9896}{ORCID}) [contributor]
|
||||||
\item Annick Lenglet (\href{https://orcid.org/0000-0003-2013-8405}{ORCID}) [contributor]
|
|
||||||
\item Christian F. Luz (\href{https://orcid.org/0000-0001-5809-5995}{ORCID}) [contributor]
|
|
||||||
\item Bart C. Meijer [contributor]
|
|
||||||
\item Dmytro Mykhailenko [contributor]
|
|
||||||
\item Anton Mymrikov [contributor]
|
|
||||||
\item Andrew P. Norgan (\href{https://orcid.org/0000-0002-2955-2066}{ORCID}) [contributor]
|
|
||||||
\item Sofia Ny (\href{https://orcid.org/0000-0002-2017-1363}{ORCID}) [contributor]
|
|
||||||
\item Matthew Saab [contributor]
|
|
||||||
\item Jonas Salm [contributor]
|
|
||||||
\item Javier Sanchez (\href{https://orcid.org/0000-0003-2605-8094}{ORCID}) [contributor]
|
|
||||||
\item Rogier P. Schade [contributor]
|
|
||||||
\item Bhanu N. M. Sinha (\href{https://orcid.org/0000-0003-1634-0010}{ORCID}) [thesis advisor]
|
|
||||||
\item Jason Stull (\href{https://orcid.org/0000-0002-9028-8153}{ORCID}) [contributor]
|
\item Jason Stull (\href{https://orcid.org/0000-0002-9028-8153}{ORCID}) [contributor]
|
||||||
\item Anthony Underwood (\href{https://orcid.org/0000-0002-8547-4277}{ORCID}) [contributor]
|
\item Javier Sanchez (\href{https://orcid.org/0000-0003-2605-8094}{ORCID}) [contributor]
|
||||||
\item Anita Williams (\href{https://orcid.org/0000-0002-5295-8451}{ORCID}) [contributor]
|
\item Jonas Salm [contributor]
|
||||||
|
\item Judith M. Fonville [contributor]
|
||||||
|
\item Larisse Bolton (\href{https://orcid.org/0000-0001-7879-2173}{ORCID}) [contributor]
|
||||||
|
\item Matthew Saab [contributor]
|
||||||
|
\item Peter Dutey-Magni (\href{https://orcid.org/0000-0002-8942-9836}{ORCID}) [contributor]
|
||||||
|
\item Rogier P. Schade [contributor]
|
||||||
|
\item Sofia Ny (\href{https://orcid.org/0000-0002-2017-1363}{ORCID}) [contributor]
|
||||||
|
\item Alex W. Friedrich (\href{https://orcid.org/0000-0003-4881-038X}{ORCID}) [thesis advisor]
|
||||||
|
\item Bhanu N. M. Sinha (\href{https://orcid.org/0000-0003-1634-0010}{ORCID}) [thesis advisor]
|
||||||
|
\item Casper J. Albers (\href{https://orcid.org/0000-0002-9213-6743}{ORCID}) [thesis advisor]
|
||||||
|
\item Corinna Glasner (\href{https://orcid.org/0000-0003-1241-1328}{ORCID}) [thesis advisor]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ not_intrinsic_resistant(
|
|||||||
\item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be "3.3", "3.2", or "3.1".}
|
\item{version_expertrules}{the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be "3.3", "3.2", or "3.1".}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
(internally) a \link{character} vector of column names, with additional class \code{"ab_selector"}
|
When used inside selecting or filtering, this returns a \link{character} vector of column names, with additional class \code{"ab_selector"}. When used individually, this returns an \link[=as.ab]{'ab' vector} with all possible antimicrobial that the function would be able to select or filter.
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class or group (according to the \link{antibiotics} data set), without the need to define the columns or antibiotic abbreviations.
|
These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class or group (according to the \link{antibiotics} data set), without the need to define the columns or antibiotic abbreviations.
|
||||||
@ -189,9 +189,15 @@ All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR
|
|||||||
example_isolates
|
example_isolates
|
||||||
|
|
||||||
|
|
||||||
|
# you can use the selectors separately to retrieve all possible antimicrobials:
|
||||||
|
carbapenems()
|
||||||
|
|
||||||
|
|
||||||
|
# Though they are primarily intended to use for selections and filters.
|
||||||
# Examples sections below are split into 'dplyr', 'base R', and 'data.table':
|
# Examples sections below are split into 'dplyr', 'base R', and 'data.table':
|
||||||
|
|
||||||
\donttest{
|
\donttest{
|
||||||
|
\dontrun{
|
||||||
# dplyr -------------------------------------------------------------------
|
# dplyr -------------------------------------------------------------------
|
||||||
|
|
||||||
library(dplyr, warn.conflicts = FALSE)
|
library(dplyr, warn.conflicts = FALSE)
|
||||||
@ -277,7 +283,7 @@ y <- example_isolates \%>\% filter(carbapenems() == "R")
|
|||||||
z <- example_isolates \%>\% filter(if_all(carbapenems(), ~ .x == "R"))
|
z <- example_isolates \%>\% filter(if_all(carbapenems(), ~ .x == "R"))
|
||||||
identical(x, y) && identical(y, z)
|
identical(x, y) && identical(y, z)
|
||||||
|
|
||||||
|
}
|
||||||
# base R ------------------------------------------------------------------
|
# base R ------------------------------------------------------------------
|
||||||
|
|
||||||
# select columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
# select columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
||||||
|
@ -49,7 +49,10 @@ geom_sir(
|
|||||||
|
|
||||||
facet_sir(facet = c("interpretation", "antibiotic"), nrow = NULL)
|
facet_sir(facet = c("interpretation", "antibiotic"), nrow = NULL)
|
||||||
|
|
||||||
scale_y_percent(breaks = seq(0, 1, 0.1), limits = NULL)
|
scale_y_percent(
|
||||||
|
breaks = function(x) seq(0, max(x, na.rm = TRUE), 0.1),
|
||||||
|
limits = NULL
|
||||||
|
)
|
||||||
|
|
||||||
scale_sir_colours(..., aesthetics = "fill")
|
scale_sir_colours(..., aesthetics = "fill")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user