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

fast-forward from pull

Merge branch 'main' of https://github.com/msberends/AMR into main

# Conflicts:
#	DESCRIPTION
#	R/add_custom_antimicrobials.R
This commit is contained in:
2022-10-11 10:53:51 +02:00
4 changed files with 15 additions and 11 deletions

View File

@ -27,9 +27,9 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
#' Add Manual Antimicrobials to This Package
#' Add Custom Antimicrobials to This Package
#'
#' With [add_custom_antimicrobials()] you can add your own manual antimicrobial codes to the `AMR` package.
#' With [add_custom_antimicrobials()] you can add your own custom antimicrobial codes to the `AMR` package.
#' @param x a [data.frame] resembling the [antibiotics] data set, at least containing columns "ab" and "name"
#' @details Due to how \R works, the [add_custom_antimicrobials()] function has to be run in every \R session - added antimicrobials are not stored between sessions and are thus lost when \R is exited. It is possible to save the antimicrobial additions to your `.Rprofile` file to circumvent this, although this requires to load the `AMR` package at every start-up:
#'
@ -55,15 +55,17 @@
#' as.ab("test")
#' )
#'
#' # now add a manual entry - it will be considered by as.ab() and
#' # now add a custom entry - it will be considered by as.ab() and
#' # all ab_*() functions
#' add_custom_antimicrobials(
#' data.frame(ab = "TEST",
#' name = "Test Antibiotic",
#' # you can add any property present in the
#' # 'antibiotics' data set, such as 'group':
#' group = "Test Group")
#' )
#'
#' "test" is now a new antibiotic:
#' # "test" is now a new antibiotic:
#' as.ab("test")
#' ab_name("test")
#' ab_group("test")
@ -128,5 +130,5 @@ clear_custom_antimicrobials <- function() {
value = create_AB_lookup(),
ns = asNamespace("AMR"))
AMR_env$custom_ab_codes <- character(0)
message_("Manual antimicrobials cleared.")
message_("Custom antimicrobials cleared.")
}