new EUCAST rules algorithm

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2019-04-05 18:47:39 +02:00
1 parent 56d4b4719f
commit fbc9191b13
115 files changed
+1340 -2174

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Name of an antibiotic
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Age in years of individuals
+3 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' The \code{AMR} Package
@@ -64,4 +64,6 @@
#' \url{https://gitlab.com/msberends/AMR/issues}
#' @name AMR
#' @rdname AMR
# # prevent NOTE on R >= 3.6
#' @importFrom microbenchmark microbenchmark
NULL
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Transform to ATC code
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Get ATC properties from WHOCC website
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Property of an antibiotic
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Check availability of columns
+2 -2
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' The Catalogue of Life
@@ -33,7 +33,7 @@
#' \item{All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria and Protozoa}
#' \item{All ~3,500 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (like all species of \emph{Aspergillus}, \emph{Candida}, \emph{Cryptococcus}, \emph{Histplasma}, \emph{Pneumocystis}, \emph{Saccharomyces} and \emph{Trichophyton}).}
#' \item{All ~2,000 (sub)species from ~100 other relevant genera, from the kingdoms of Animalia and Plantae (like \emph{Strongyloides} and \emph{Taenia})}
#' \item{All ~15,000 previously accepted names of included (sub)species that have been taxonomically renamed}
#' \item{All ~21,000 previously accepted names of included (sub)species that have been taxonomically renamed}
#' \item{The complete taxonomic tree of all included (sub)species: from kingdom to subspecies}
#' \item{The responsible author(s) and year of scientific publication}
#' }
+5 -5
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Count isolates
@@ -74,15 +74,15 @@
#' # Count co-resistance between amoxicillin/clav acid and gentamicin,
#' # so we can see that combination therapy does a lot more than mono therapy.
#' # Please mind that `portion_S` calculates percentages right away instead.
#' count_S(septic_patients$amcl) # S = 1057 (67.1%)
#' count_all(septic_patients$amcl) # n = 1576
#' count_S(septic_patients$amcl) # S = 1342 (71.4%)
#' count_all(septic_patients$amcl) # n = 1879
#'
#' count_S(septic_patients$gent) # S = 1372 (74.0%)
#' count_all(septic_patients$gent) # n = 1855
#'
#' with(septic_patients,
#' count_S(amcl, gent)) # S = 1396 (92.0%)
#' with(septic_patients, # n = 1517
#' count_S(amcl, gent)) # S = 1660 (92.3%)
#' with(septic_patients, # n = 1798
#' n_rsi(amcl, gent))
#'
#' # Get portions S/I/R immediately of all rsi columns
+26 -6
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Data set with ~500 antibiotics
@@ -183,14 +183,14 @@ catalogue_of_life <- list(
#'
#' A data set containing old (previously valid or accepted) taxonomic names according to the Catalogue of Life. This data set is used internally by \code{\link{as.mo}}.
#' @inheritSection catalogue_of_life Catalogue of Life
#' @format A \code{\link{data.frame}} with 16,911 observations and 4 variables:
#' @format A \code{\link{data.frame}} with 21,342 observations and 4 variables:
#' \describe{
#' \item{\code{col_id}}{Catalogue of Life ID}
#' \item{\code{tsn_new}}{New Catalogue of Life ID}
#' \item{\code{fullname}}{Old taxonomic name of the microorganism}
#' \item{\code{col_id}}{Catalogue of Life ID that was originally given}
#' \item{\code{col_id_new}}{New Catalogue of Life ID that responds to an entry in the \code{\link{microorganisms}} data set}
#' \item{\code{fullname}}{Old full taxonomic name of the microorganism}
#' \item{\code{ref}}{Author(s) and year of concerning scientific publication}
#' }
#' @source [3] Catalogue of Life: Annual Checklist (public online database), \url{www.catalogueoflife.org}.
#' @source Catalogue of Life: Annual Checklist (public online taxonomic database), \url{www.catalogueoflife.org} (check included annual version with \code{\link{catalogue_of_life_version}()}).
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms}}
"microorganisms.old"
@@ -261,3 +261,23 @@ catalogue_of_life <- list(
#' }
#' @inheritSection AMR Read more on our website!
"WHONET"
# transforms data set to data.frame with only ASCII values, to comply with CRAN policies
dataset_UTF8_to_ASCII <- function(df) {
trans <- function(vect) {
iconv(vect, from = "UTF-8", to = "ASCII//TRANSLIT")
}
df <- as.data.frame(df, stringsAsFactors = FALSE)
for (i in 1:NCOL(df)) {
col <- df[, i]
if (is.factor(col)) {
levels(col) <- trans(levels(col))
} else if (is.character(col)) {
col <- trans(col)
} else {
col
}
df[, i] <- col
}
df
}
+1 -15
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Deprecated functions
@@ -47,20 +47,6 @@ ratio <- function(x, ratio) {
sum(x, na.rm = TRUE) * (ratio / sum(ratio, na.rm = TRUE))
}
#' @rdname AMR-deprecated
#' @export
guess_mo <- function(...) {
.Deprecated(new = "as.mo", package = "AMR")
as.mo(...)
}
#' @rdname AMR-deprecated
#' @export
guess_atc <- function(...) {
.Deprecated(new = "as.atc", package = "AMR")
as.atc(...)
}
#' @rdname AMR-deprecated
#' @export
ab_property <- function(...) {
+386 -1475
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Filter isolates on result in antibiotic class
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Determine first (weighted) isolates
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Frequency table
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' \emph{G}-test for Count Data
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Get language for AMR
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' AMR plots with \code{ggplot2}
+9 -2
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
globalVariables(c(".",
@@ -28,6 +28,7 @@ globalVariables(c(".",
"authors",
"Becker",
"certe",
"CNS_CPS",
"cnt",
"col_id",
"count",
@@ -46,8 +47,8 @@ globalVariables(c(".",
"genus",
"gramstain",
"index",
"Interpretation",
"input",
"Interpretation",
"item",
"key_ab",
"key_ab_lag",
@@ -81,6 +82,7 @@ globalVariables(c(".",
"Pasted",
"patient_id",
"phylum",
"plural",
"prevalence",
"prevalent",
"property",
@@ -88,6 +90,10 @@ globalVariables(c(".",
"R",
"real_first_isolate",
"ref",
"reference.rule",
"reference.rule_group",
"rule_group",
"rule_name",
"S",
"se_max",
"se_min",
@@ -101,6 +107,7 @@ globalVariables(c(".",
"transmute",
"tsn",
"tsn_new",
"txt",
"umcg",
"value",
"Value",
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Guess antibiotic column
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Join a table with \code{microorganisms}
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Key antibiotics for first \emph{weighted} isolates
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Kurtosis of the sample
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Pattern Matching
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Determine multidrug-resistant organisms (MDRO)
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Class 'mic'
+4 -4
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
# No export, no Rd
@@ -76,18 +76,18 @@ check_available_columns <- function(tbl, col.list, info = TRUE) {
# are they available as upper case or lower case then?
for (i in 1:length(col.list)) {
if (is.null(col.list[i]) | isTRUE(is.na(col.list[i]))) {
col.list[i] <- NULL
col.list[i] <- NA
} else if (toupper(col.list[i]) %in% colnames(tbl)) {
col.list[i] <- toupper(col.list[i])
} else if (tolower(col.list[i]) %in% colnames(tbl)) {
col.list[i] <- tolower(col.list[i])
} else if (!col.list[i] %in% colnames(tbl)) {
col.list[i] <- NULL
col.list[i] <- NA
}
}
if (!all(col.list %in% colnames(tbl))) {
if (info == TRUE) {
warning('These columns do not exist and will be ignored: ',
warning('Some columns do not exist and will be ignored: ',
col.list.bak[!(col.list %in% colnames(tbl))] %>% toString(),
'.\nTHIS MAY STRONGLY INFLUENCE THE OUTCOME.',
immediate. = TRUE,
+1 -2
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Transform to microorganism ID
@@ -229,7 +229,6 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE,
& isFALSE(Lancefield)) {
y <- x
} else if (!any(is.na(mo_hist))
& isFALSE(Becker)
& isFALSE(Lancefield)) {
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
# print successful as.mo coercions to AMR environment
+11 -6
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Property of a microorganism
@@ -136,7 +136,7 @@ mo_fullname <- function(x, language = get_locale(), ...) {
}
#' @rdname mo_property
#' @importFrom dplyr %>% left_join mutate pull
#' @importFrom dplyr %>% mutate pull
#' @export
mo_shortname <- function(x, language = get_locale(), ...) {
dots <- list(...)
@@ -247,7 +247,12 @@ mo_phylum <- function(x, language = get_locale(), ...) {
#' @rdname mo_property
#' @export
mo_kingdom <- function(x, language = get_locale(), ...) {
mo_translate(mo_validate(x = x, property = "kingdom", ...), language = language)
kngdm <- mo_validate(x = x, property = "kingdom", ...)
if (language != "en") {
unknowns <- as.mo(x, ...) == "UNKOWN"
kngdm[unknowns] <- mo_translate(kngdm[unknowns], language = language)
}
kngdm
}
#' @rdname mo_property
@@ -260,14 +265,14 @@ mo_type <- function(x, language = get_locale(), ...) {
#' @export
mo_gramstain <- function(x, language = get_locale(), ...) {
x.bak <- x
x.mo <- as.mo(x, ...)
x.phylum <- mo_phylum(x.mo)
x.mo <- as.mo(x, language = "en", ...)
x.phylum <- mo_phylum(x.mo, language = "en")
x[x.phylum %in% c("Actinobacteria",
"Chloroflexi",
"Firmicutes",
"Tenericutes")] <- "Gram positive"
x[x != "Gram positive"] <- "Gram negative"
x[mo_kingdom(x.mo) != "Bacteria"] <- NA_character_
x[mo_kingdom(x.mo, language = "en") != "Bacteria"] <- NA_character_
x[x.mo == "B_GRAMP"] <- "Gram positive"
x[x.mo == "B_GRAMN"] <- "Gram negative"
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Use predefined reference data set
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Symbol of a p value
+5 -5
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Calculate resistance of isolates
@@ -100,14 +100,14 @@
#'
#' # Calculate co-resistance between amoxicillin/clav acid and gentamicin,
#' # so we can see that combination therapy does a lot more than mono therapy:
#' septic_patients %>% portion_S(amcl) # S = 67.1%
#' septic_patients %>% count_all(amcl) # n = 1576
#' septic_patients %>% portion_S(amcl) # S = 71.4%
#' septic_patients %>% count_all(amcl) # n = 1879
#'
#' septic_patients %>% portion_S(gent) # S = 74.0%
#' septic_patients %>% count_all(gent) # n = 1855
#'
#' septic_patients %>% portion_S(amcl, gent) # S = 92.0%
#' septic_patients %>% count_all(amcl, gent) # n = 1517
#' septic_patients %>% portion_S(amcl, gent) # S = 92.3%
#' septic_patients %>% count_all(amcl, gent) # n = 1798
#'
#'
#' septic_patients %>%
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Read data from 4D database
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Predict antimicrobial resistance
+7 -2
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Class 'rsi'
@@ -114,7 +114,12 @@ mic_like <- function(x) {
gsub("[^0-9.,]+", "", .) %>%
unique()
mic_valid <- suppressWarnings(as.mic(mic))
sum(!is.na(mic_valid)) / length(mic)
result <- sum(!is.na(mic_valid)) / length(mic)
if (is.na(result)) {
0
} else {
result
}
}
#' @rdname as.rsi
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' @importFrom dplyr %>% pull all_vars any_vars filter_all funs mutate_all
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' Skewness of the sample
+1 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' WHOCC: WHO Collaborating Centre for Drug Statistics Methodology
+10 -1
View File
@@ -16,7 +16,7 @@
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' @importFrom data.table as.data.table setkey
@@ -44,6 +44,15 @@
assign(x = "mo_codes_v0.5.0",
value = make_trans_tbl(),
envir = asNamespace("AMR"))
assign(x = "mo_history",
value = data.frame(x = character(0),
mo = character(0),
uncertainty_level = integer(0),
package_v = character(0),
stringsAsFactors = FALSE),
envir = asNamespace("AMR"))
}
#' @importFrom dplyr mutate case_when