(v1.1.0.9012) lose dependencies

This commit is contained in:
dr. M.S. (Matthijs) Berends 2020-05-19 12:08:49 +02:00
parent 218fd08097
commit 19703eb5d3
40 changed files with 101 additions and 584 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 1.1.0.9011
Date: 2020-05-18
Version: 1.1.0.9012
Date: 2020-05-19
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(role = c("aut", "cre"),
@ -35,12 +35,9 @@ Description: Functions to simplify the analysis and prediction of Antimicrobial
<doi:10.1111/j.1469-0691.2011.03703.x> and the Clinical and Laboratory
Standards Institute (2014) <isbn: 1-56238-899-1>.
Depends:
R (>= 3.1.0)
Imports:
cleaner,
pillar,
vctrs
R (>= 3.0.0)
Suggests:
cleaner,
covr,
dplyr,
ggplot2,

View File

@ -19,7 +19,6 @@ S3method("[[<-",mic)
S3method("[[<-",mo)
S3method("[[<-",rsi)
S3method(as.data.frame,ab)
S3method(as.data.frame,disk)
S3method(as.data.frame,mo)
S3method(as.double,mic)
S3method(as.integer,mic)
@ -43,11 +42,6 @@ S3method(freq,rsi)
S3method(kurtosis,data.frame)
S3method(kurtosis,default)
S3method(kurtosis,matrix)
S3method(pillar_shaft,ab)
S3method(pillar_shaft,disk)
S3method(pillar_shaft,mic)
S3method(pillar_shaft,mo)
S3method(pillar_shaft,rsi)
S3method(plot,mic)
S3method(plot,resistance_predict)
S3method(plot,rsi)
@ -66,30 +60,6 @@ S3method(skewness,matrix)
S3method(summary,mic)
S3method(summary,mo)
S3method(summary,rsi)
S3method(vec_cast.ab,ab)
S3method(vec_cast.ab,character)
S3method(vec_cast.ab,default)
S3method(vec_cast.character,ab)
S3method(vec_cast.character,mo)
S3method(vec_cast.mo,character)
S3method(vec_cast.mo,default)
S3method(vec_cast.mo,mo)
S3method(vec_ptype2.ab,character)
S3method(vec_ptype2.ab,default)
S3method(vec_ptype2.character,ab)
S3method(vec_ptype2.character,mo)
S3method(vec_ptype2.mo,character)
S3method(vec_ptype2.mo,default)
S3method(vec_ptype_abbr,ab)
S3method(vec_ptype_abbr,disk)
S3method(vec_ptype_abbr,mic)
S3method(vec_ptype_abbr,mo)
S3method(vec_ptype_abbr,rsi)
S3method(vec_ptype_full,ab)
S3method(vec_ptype_full,disk)
S3method(vec_ptype_full,mic)
S3method(vec_ptype_full,mo)
S3method(vec_ptype_full,rsi)
export("%like%")
export("%like_case%")
export(ab_atc)
@ -147,7 +117,6 @@ export(filter_glycopeptides)
export(filter_macrolides)
export(filter_tetracyclines)
export(first_isolate)
export(freq)
export(full_join_microorganisms)
export(g.test)
export(geom_rsi)
@ -221,18 +190,12 @@ export(right_join_microorganisms)
export(rsi_df)
export(rsi_predict)
export(scale_rsi_colours)
export(scale_type.ab)
export(scale_type.mo)
export(scale_y_percent)
export(semi_join_microorganisms)
export(set_mo_source)
export(skewness)
export(susceptibility)
export(theme_rsi)
export(vec_cast.ab)
export(vec_cast.mo)
export(vec_ptype2.ab)
export(vec_ptype2.mo)
exportMethods("[.ab")
exportMethods("[.disk")
exportMethods("[.mic")
@ -252,7 +215,6 @@ exportMethods("[[<-.mic")
exportMethods("[[<-.mo")
exportMethods("[[<-.rsi")
exportMethods(as.data.frame.ab)
exportMethods(as.data.frame.disk)
exportMethods(as.data.frame.mo)
exportMethods(as.double.mic)
exportMethods(as.integer.mic)
@ -267,8 +229,6 @@ exportMethods(c.rsi)
exportMethods(droplevels.mic)
exportMethods(droplevels.rsi)
exportMethods(format.bug_drug_combinations)
exportMethods(freq.mo)
exportMethods(freq.rsi)
exportMethods(kurtosis)
exportMethods(kurtosis.data.frame)
exportMethods(kurtosis.default)
@ -284,8 +244,6 @@ exportMethods(print.mo)
exportMethods(print.mo_renamed)
exportMethods(print.mo_uncertainties)
exportMethods(print.rsi)
exportMethods(scale_type.ab)
exportMethods(scale_type.mo)
exportMethods(skewness)
exportMethods(skewness.data.frame)
exportMethods(skewness.default)
@ -293,22 +251,6 @@ exportMethods(skewness.matrix)
exportMethods(summary.mic)
exportMethods(summary.mo)
exportMethods(summary.rsi)
exportMethods(vec_cast.character.ab)
exportMethods(vec_cast.character.mo)
exportMethods(vec_ptype2.character.ab)
exportMethods(vec_ptype2.character.mo)
exportMethods(vec_ptype_abbr.ab)
exportMethods(vec_ptype_abbr.disk)
exportMethods(vec_ptype_abbr.mic)
exportMethods(vec_ptype_abbr.mo)
exportMethods(vec_ptype_abbr.rsi)
exportMethods(vec_ptype_full.ab)
exportMethods(vec_ptype_full.disk)
exportMethods(vec_ptype_full.mic)
exportMethods(vec_ptype_full.mo)
exportMethods(vec_ptype_full.rsi)
importFrom(cleaner,freq)
importFrom(cleaner,freq.default)
importFrom(graphics,arrows)
importFrom(graphics,axis)
importFrom(graphics,barplot)
@ -316,7 +258,6 @@ importFrom(graphics,par)
importFrom(graphics,plot)
importFrom(graphics,points)
importFrom(graphics,text)
importFrom(pillar,pillar_shaft)
importFrom(stats,complete.cases)
importFrom(stats,glm)
importFrom(stats,lm)
@ -325,9 +266,3 @@ importFrom(stats,prcomp)
importFrom(stats,predict)
importFrom(stats,qchisq)
importFrom(stats,var)
importFrom(vctrs,vec_cast)
importFrom(vctrs,vec_cast.character)
importFrom(vctrs,vec_default_cast)
importFrom(vctrs,vec_ptype2.character)
importFrom(vctrs,vec_ptype_abbr)
importFrom(vctrs,vec_ptype_full)

17
NEWS.md
View File

@ -1,8 +1,17 @@
# AMR 1.1.0.9011
## <small>Last updated: 18-May-2020</small>
# AMR 1.1.0.9012
## <small>Last updated: 19-May-2020</small>
### Breaking
* Removed previously deprecated function `p.symbol()` - it was replaced with `p_symbol()`
* Removed code dependency on **all** R packages that this `AMR` package relied upon: `cleaner`, `crayon`, `data.table`, `dplyr`, `ggplot2`, `knitr`, `microbenchmark`, `pillar`, `R6`, `rlang`, `tidyr` and `vctrs`. This is a major code change, but will probably not be noticeable by most users.
Making this package independent on especially the tidyverse tremendously increases sustainability on the long term, since tidyverse functions change quite often. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.
Negative effects of this change are:
* Function `freq()` that was borrowed from the `cleaner` package was removed. Use `cleaner::freq()`, or run `library("cleaner")` before you use `freq()`.
* Printing values of class `mo` or `ab` in a tibble will no longer be in colour.
* All functions from the `mo_*` family (like `mo_name()` and `mo_gramstain()`) are noticeably slower when running on tens of thousands of rows.
* For developers: classes `mo` and `ab` now both also inherit class `character`, to support any data transformation. This change invalidates code that checks for class length == 1.
### Changed
* Small fix for some text input that could not be coerced as valid MIC values
@ -11,7 +20,7 @@
* Added official drug names to verbose output of `eucast_rules()`
### Other
* Removed dependency on **all** packages that were needed for the `AMR` package to work properly: `backports`, `crayon`, `data.table`, `dplyr`, `ggplot2`, `R6`, `rlang` and `tidyr`. This is a major code change, but will probably not be noticeable by users. Making this package independent on especially the tidyverse (packages `dplyr`, `ggplot2` and `tidyr`) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. The only dependencies that remained are for extending methods of other packages, like `pillar` and `vctrs` for printing and working with tibbles using our classes `mo` and `ab`.
* Removed previously deprecated function `p.symbol()` - it was replaced with `p_symbol()`
* Removed function `read.4d()`, that was only useful for reading from an old test database.
# AMR 1.1.0

View File

@ -427,6 +427,8 @@ percentage <- function(x, digits = NULL, ...) {
}
# prevent dependency on package 'backports'
# these functions were not available in previous versions of R (last checked: R 4.0.0)
# see here for the full list: https://github.com/r-lib/backports
strrep = function(x, times) {
x = as.character(x)
if (length(x) == 0L)
@ -451,3 +453,6 @@ trimws <- function (x, which = c("both", "left", "right")) {
isFALSE <- function (x) {
is.logical(x) && length(x) == 1L && !is.na(x) && !x
}
deparse1 = function (expr, collapse = " ", width.cutoff = 500L, ...) {
paste(deparse(expr, width.cutoff, ...), collapse = collapse)
}

23
R/ab.R
View File

@ -75,7 +75,7 @@ as.ab <- function(x, ...) {
if (all(toupper(x) %in% antibiotics$ab)) {
# valid AB code, but not yet right class
return(structure(.Data = toupper(x),
class = "ab"))
class = c("ab", "character")))
}
x_bak <- x
@ -332,7 +332,7 @@ as.ab <- function(x, ...) {
}
structure(.Data = x_result,
class = "ab")
class = c("ab", "character"))
}
#' @rdname as.ab
@ -352,17 +352,14 @@ print.ab <- function(x, ...) {
#' @exportMethod as.data.frame.ab
#' @export
#' @noRd
as.data.frame.ab <- function(x, ...) {
# same as as.data.frame.character but with removed stringsAsFactors
nm <- paste(deparse(substitute(x), width.cutoff = 500L),
collapse = " ")
as.data.frame.ab <- function (x, ...) {
nm <- deparse1(substitute(x))
if (!"nm" %in% names(list(...))) {
as.data.frame.vector(x, ..., nm = nm)
as.data.frame.vector(as.ab(x), ..., nm = nm)
} else {
as.data.frame.vector(x, ...)
as.data.frame.vector(as.ab(x), ...)
}
}
#' @exportMethod [.ab
#' @export
#' @noRd
@ -403,11 +400,3 @@ c.ab <- function(x, ...) {
attributes(y) <- attributes(x)
class_integrity_check(y, "antimicrobial code", antibiotics$ab)
}
#' @importFrom pillar pillar_shaft
#' @export
pillar_shaft.ab <- function(x, ...) {
out <- format(x)
out[is.na(x)] <- font_red("NA")
pillar::new_pillar_shaft_simple(out, align = "left", min_width = 4)
}

View File

@ -53,9 +53,7 @@
#' as.rsi(df)
#' }
as.disk <- function(x, na.rm = FALSE) {
if (is.disk(x)) {
x
} else {
if (!is.disk(x)) {
x <- x %>% unlist()
if (na.rm == TRUE) {
x <- x[!is.na(x)]
@ -81,10 +79,9 @@ as.disk <- function(x, na.rm = FALSE) {
"%) that were invalid disk zones: ",
list_missing, call. = FALSE)
}
class(x) <- "disk"
x
}
structure(as.integer(x),
class = c("disk", "integer"))
}
all_valid_disks <- function(x) {
@ -98,20 +95,6 @@ is.disk <- function(x) {
inherits(x, "disk")
}
#' @exportMethod as.data.frame.disk
#' @export
#' @noRd
as.data.frame.disk <- function(x, ...) {
# same as as.data.frame.integer but with removed stringsAsFactors, since it will be class "disk"
nm <- paste(deparse(substitute(x), width.cutoff = 500L),
collapse = " ")
if (!"nm" %in% names(list(...))) {
as.data.frame.vector(x, ..., nm = nm)
} else {
as.data.frame.vector(x, ...)
}
}
#' @exportMethod print.disk
#' @export
#' @noRd
@ -120,14 +103,6 @@ print.disk <- function(x, ...) {
print(as.integer(x), quote = FALSE)
}
#' @importFrom pillar pillar_shaft
#' @export
pillar_shaft.disk <- function(x, ...) {
out <- trimws(format(x))
out[is.na(x)] <- font_red(NA)
pillar::new_pillar_shaft_simple(out, align = "right", min_width = 3)
}
#' @exportMethod [.disk
#' @export
#' @noRd

View File

@ -19,12 +19,15 @@
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
#' @importFrom cleaner freq
#' @export
cleaner::freq
if ("cleaner" %in% rownames(utils::installed.packages())) {
freq <- get("freq", envir = asNamespace("cleaner"))
freq.default <- get("freq.default", envir = asNamespace("cleaner"))
} else {
freq <- ""
freq.default <- ""
}
#' @exportMethod freq.mo
#' @importFrom cleaner freq.default
#' @method freq mo
#' @export
#' @noRd
freq.mo <- function(x, ...) {
@ -47,11 +50,10 @@ freq.mo <- function(x, ...) {
")"),
`No of genera` = n_distinct(mo_genus(x_noNA, language = NULL)),
`No of species` = n_distinct(paste(mo_genus(x_noNA, language = NULL),
mo_species(x_noNA, language = NULL)))))
mo_species(x_noNA, language = NULL)))))
}
#' @exportMethod freq.rsi
#' @importFrom cleaner freq.default
#' @method freq rsi
#' @export
#' @noRd
freq.rsi <- function(x, ...) {

View File

@ -232,14 +232,6 @@ barplot.mic <- function(height,
axis(2, seq(0, max(table(droplevels.factor(height)))))
}
#' @importFrom pillar pillar_shaft
#' @export
pillar_shaft.mic <- function(x, ...) {
out <- trimws(format(x))
out[is.na(x)] <- font_red(NA)
pillar::new_pillar_shaft_simple(out, align = "right", min_width = 4)
}
#' @exportMethod [.mic
#' @export
#' @noRd

34
R/mo.R
View File

@ -230,7 +230,8 @@ as.mo <- function(x,
}
to_class_mo <- function(x) {
structure(.Data = x, class = "mo")
structure(.Data = x,
class = c("mo", "character"))
}
#' @rdname as.mo
@ -1558,27 +1559,6 @@ print.mo <- function(x, ...) {
print.default(x, quote = FALSE)
}
#' @importFrom pillar pillar_shaft
#' @export
pillar_shaft.mo <- function(x, ...) {
out <- format(x)
# grey out the kingdom (part until first "_")
out[!is.na(x)] <- gsub("^([A-Z]+_)(.*)", paste0(font_subtle("\\1"), "\\2"), out[!is.na(x)])
# and grey out every _
out[!is.na(x)] <- gsub("_", font_subtle("_"), out[!is.na(x)])
# markup NA and UNKNOWN
out[is.na(x)] <- font_red(" NA")
out[x == "UNKNOWN"] <- font_red(" UNKNOWN")
# make it always fit exactly
pillar::new_pillar_shaft_simple(out,
align = "left",
width = max(nchar(x)) + ifelse(length(x[x %in% c(NA, "UNKNOWN")]) > 0,
2,
0))
}
#' @exportMethod summary.mo
#' @export
#' @noRd
@ -1598,14 +1578,12 @@ summary.mo <- function(object, ...) {
#' @exportMethod as.data.frame.mo
#' @export
#' @noRd
as.data.frame.mo <- function(x, ...) {
# same as as.data.frame.character but with removed stringsAsFactors, since it will be class "mo"
nm <- paste(deparse(substitute(x), width.cutoff = 500L),
collapse = " ")
as.data.frame.mo <- function (x, ...) {
nm <- deparse1(substitute(x))
if (!"nm" %in% names(list(...))) {
as.data.frame.vector(x, ..., nm = nm)
as.data.frame.vector(as.mo(x), ..., nm = nm)
} else {
as.data.frame.vector(x, ...)
as.data.frame.vector(as.mo(x), ...)
}
}

11
R/rsi.R
View File

@ -650,17 +650,6 @@ barplot.rsi <- function(height,
}
}
#' @importFrom pillar pillar_shaft
#' @export
pillar_shaft.rsi <- function(x, ...) {
out <- trimws(format(x))
out[is.na(x)] <- font_subtle(" NA")
out[x == "S"] <- font_green_bg(font_white(" S "))
out[x == "I"] <- font_yellow_bg(font_black(" I "))
out[x == "R"] <- font_red_bg(font_white(" R "))
pillar::new_pillar_shaft_simple(out, align = "left", width = 3)
}
#' @exportMethod [<-.rsi
#' @export
#' @noRd

View File

@ -45,7 +45,7 @@ rsi_calc <- function(...,
stop("`only_all_tested` must be logical", call. = FALSE)
}
dots_df <- switch(1, ...) # it needs this evaluation
dots_df <- switch(1, ...)
dots <- base::eval(base::substitute(base::alist(...)))
if ("also_single_tested" %in% names(dots)) {
stop("`also_single_tested` was replaced by `only_all_tested`. Please read Details in the help page (`?proportion`) as this may have a considerable impact on your analysis.", call. = FALSE)
@ -53,21 +53,21 @@ rsi_calc <- function(...,
ndots <- length(dots)
if ("data.frame" %in% class(dots_df)) {
# data.frame passed with other columns, like: example_isolates %>% proportion_S(amcl, gent)
# data.frame passed with other columns, like: example_isolates %>% proportion_S(AMC, GEN)
dots <- as.character(dots)
dots <- dots[dots != "."]
if (length(dots) == 0 | all(dots == "df")) {
# for complete data.frames, like example_isolates %>% select(amcl, gent) %>% proportion_S()
# for complete data.frames, like example_isolates %>% select(AMC, GEN) %>% proportion_S()
# and the old rsi function, which has "df" as name of the first parameter
x <- dots_df
} else {
x <- dots_df[, dots[dots %in% colnames(dots_df)]]
}
} else if (ndots == 1) {
# only 1 variable passed (can also be data.frame), like: proportion_S(example_isolates$amcl) and example_isolates$amcl %>% proportion_S()
# only 1 variable passed (can also be data.frame), like: proportion_S(example_isolates$AMC) and example_isolates$AMC %>% proportion_S()
x <- dots_df
} else {
# multiple variables passed without pipe, like: proportion_S(example_isolates$amcl, example_isolates$gent)
# multiple variables passed without pipe, like: proportion_S(example_isolates$AMC, example_isolates$GEN)
x <- NULL
try(x <- as.data.frame(dots), silent = TRUE)
if (is.null(x)) {

Binary file not shown.

View File

@ -1,257 +0,0 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# (c) 2018-2020 Berends MS, Luz CF et al. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# #
# We created this package for both routine data analysis and academic #
# research and it 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.gitlab.io/AMR. #
# ==================================================================== #
#' Methods for tidyverse
#'
#' These methods are needed to support methods used by the tidyverse, like joining and transforming data, with new classes that come with this package.
#' @inheritSection lifecycle Stable lifecycle
#' @inheritSection AMR Read more on our website!
#' @keywords internal
#' @name AMR-tidyverse
NULL
#' @rdname AMR-tidyverse
#' @exportMethod scale_type.mo
#' @export
scale_type.mo <- function(x) {
# fix for:
# "Don't know how to automatically pick scale for object of type mo. Defaulting to continuous."
# "Error: Discrete value supplied to continuous scale"
"discrete"
}
#' @rdname AMR-tidyverse
#' @exportMethod scale_type.ab
#' @export
scale_type.ab <- function(x) {
# fix for:
# "Don't know how to automatically pick scale for object of type mo. Defaulting to continuous."
# "Error: Discrete value supplied to continuous scale"
"discrete"
}
# Class mo ----------------------------------------------------------------
#' @exportMethod vec_ptype_abbr.mo
#' @importFrom vctrs vec_ptype_abbr
#' @export
vec_ptype_abbr.mo <- function(x, ...) {
"mo"
}
#' @exportMethod vec_ptype_full.mo
#' @importFrom vctrs vec_ptype_full
#' @export
vec_ptype_full.mo <- function(x, ...) {
"mo"
}
#' @rdname AMR-tidyverse
#' @export
vec_ptype2.mo <- function(x, y, ...) {
UseMethod("vec_ptype2.mo", y)
}
#' @method vec_ptype2.mo default
#' @export
vec_ptype2.mo.default <- function(x, y, ..., x_arg = "x", y_arg = "y") {
vctrs::vec_default_ptype2(x, y, x_arg = x_arg, y_arg = y_arg)
}
#' @method vec_ptype2.mo character
#' @export
vec_ptype2.mo.character <- function(x, y, ...) {
x
}
#' @method vec_ptype2.character mo
#' @exportMethod vec_ptype2.character.mo
#' @importFrom vctrs vec_ptype2.character
#' @export
vec_ptype2.character.mo <- function(x, y, ...) {
y
}
#' @rdname AMR-tidyverse
#' @export
vec_cast.mo <- function(x, to, ...) {
UseMethod("vec_cast.mo")
}
#' @method vec_cast.mo mo
#' @export
vec_cast.mo.mo <- function(x, to, ...) {
as.mo(x)
}
#' @method vec_cast.mo character
#' @export
vec_cast.mo.character <- function(x, to, ...) {
as.mo(x)
}
#' @method vec_cast.mo default
#' @importFrom vctrs vec_default_cast
#' @export
vec_cast.mo.default <- function(x, to, ...) {
vec_default_cast(x, to)
}
#' @method vec_cast.character mo
#' @exportMethod vec_cast.character.mo
#' @importFrom vctrs vec_cast vec_cast.character
#' @export
vec_cast.character.mo <- function(x, to, ...) {
unclass(x)
}
# Class ab ----------------------------------------------------------------
#' @exportMethod vec_ptype_abbr.ab
#' @importFrom vctrs vec_ptype_abbr
#' @export
vec_ptype_abbr.ab <- function(x, ...) {
"ab"
}
#' @exportMethod vec_ptype_full.ab
#' @importFrom vctrs vec_ptype_full
#' @export
vec_ptype_full.ab <- function(x, ...) {
"ab"
}
#' @rdname AMR-tidyverse
#' @export
vec_ptype2.ab <- function(x, y, ...) {
UseMethod("vec_ptype2.ab", y)
}
#' @method vec_ptype2.ab default
#' @export
vec_ptype2.ab.default <- function(x, y, ..., x_arg = "x", y_arg = "y") {
vctrs::vec_default_ptype2(x, y, x_arg = x_arg, y_arg = y_arg)
}
#' @method vec_ptype2.ab character
#' @export
vec_ptype2.ab.character <- function(x, y, ...) {
x
}
#' @method vec_ptype2.character ab
#' @exportMethod vec_ptype2.character.ab
#' @importFrom vctrs vec_ptype2.character
#' @export
vec_ptype2.character.ab <- function(x, y, ...) {
y
}
#' @rdname AMR-tidyverse
#' @export
vec_cast.ab <- function(x, to, ...) {
UseMethod("vec_cast.ab")
}
#' @method vec_cast.ab ab
#' @export
vec_cast.ab.ab <- function(x, to, ...) {
as.ab(x)
}
#' @method vec_cast.ab character
#' @export
vec_cast.ab.character <- function(x, to, ...) {
as.ab(x)
}
#' @method vec_cast.ab default
#' @importFrom vctrs vec_default_cast
#' @export
vec_cast.ab.default <- function(x, to, ...) {
vec_default_cast(x, to)
}
#' @method vec_cast.character ab
#' @exportMethod vec_cast.character.ab
#' @importFrom vctrs vec_cast vec_cast.character
#' @export
vec_cast.character.ab <- function(x, to, ...) {
unclass(x)
}
# Class disk --------------------------------------------------------------
#' @exportMethod vec_ptype_abbr.disk
#' @importFrom vctrs vec_ptype_abbr
#' @export
vec_ptype_abbr.disk <- function(x, ...) {
"disk"
}
#' @exportMethod vec_ptype_full.disk
#' @importFrom vctrs vec_ptype_full
#' @export
vec_ptype_full.disk <- function(x, ...) {
"disk"
}
# Class rsi --------------------------------------------------------------
#' @exportMethod vec_ptype_abbr.rsi
#' @importFrom vctrs vec_ptype_abbr
#' @export
vec_ptype_abbr.rsi <- function(x, ...) {
"rsi"
}
#' @exportMethod vec_ptype_full.rsi
#' @importFrom vctrs vec_ptype_full
#' @export
vec_ptype_full.rsi <- function(x, ...) {
"rsi"
}
# Class mic --------------------------------------------------------------
#' @exportMethod vec_ptype_abbr.mic
#' @importFrom vctrs vec_ptype_abbr
#' @export
vec_ptype_abbr.mic <- function(x, ...) {
"mic"
}
#' @exportMethod vec_ptype_full.mic
#' @importFrom vctrs vec_ptype_full
#' @export
vec_ptype_full.mic <- function(x, ...) {
"mic"
}

View File

@ -162,8 +162,6 @@ reference:
contents:
- "`get_locale`"
- "`like`"
- "`reexports`"
- "`AMR-tidyverse`"
- title: Deprecated functions
desc: >
These functions are deprecated, meaning that they will still

View File

@ -56,6 +56,7 @@ for (i in 2:length(unique_ip)) {
ip_tbl <- ip_tbl %>%
bind_rows(GET_df(unique_ip[i]))
}
close(p)
ip_tbl.bak <- ip_tbl

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9011</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9012</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9011</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9012</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9011</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9012</span>
</span>
</div>

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9011</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9012</span>
</span>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -43,7 +43,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9011</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9012</span>
</span>
</div>
@ -200,7 +200,7 @@ A methods paper about this package has been preprinted at bioRxiv (DOI: 10.1101/
<p><em>(<help title="Too Long, Didn't Read">TLDR</help> - to find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.</em></p>
<p><code>AMR</code> is a free, open-source and independent <a href="https://www.r-project.org">R package</a> to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. <strong>Our aim is to provide a standard</strong> for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.</p>
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~70,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~550 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code (including ATC, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p>
<p>We created this package for both routine data analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology &amp; Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is <a href="./news">actively maintained</a> and is free software (see <a href="#copyright">Copyright</a>).</p>
<p>We created this package for both routine data analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology &amp; Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is <a href="./news">actively maintained</a> and is free software (see <a href="#copyright">Copyright</a>). It is fully independent on any other R package and only requires R version 3.0.0 (April 2013) or higher to run.</p>
<div class="main-content">
<p>
<a href="./countries_large.png" target="_blank"><img src="./countries.png" class="countries_map"></a> <strong>Used in more than 100 countries</strong><br> Since its first public release in early 2018, this package has been downloaded from more than 100 countries <small>(source: <a href="https://cran-logs.rstudio.com" target="_blank">CRAN logs</a>)</small>. Click the map to enlarge, to see the names of the countries.

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9011</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9012</span>
</span>
</div>
@ -229,19 +229,28 @@
<small>Source: <a href='https://gitlab.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1-1-0-9011" class="section level1">
<h1 class="page-header" data-toc-text="1.1.0.9011">
<a href="#amr-1-1-0-9011" class="anchor"></a>AMR 1.1.0.9011<small> Unreleased </small>
<div id="amr-1-1-0-9012" class="section level1">
<h1 class="page-header" data-toc-text="1.1.0.9012">
<a href="#amr-1-1-0-9012" class="anchor"></a>AMR 1.1.0.9012<small> Unreleased </small>
</h1>
<div id="last-updated-18-may-2020" class="section level2">
<div id="last-updated-19-may-2020" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-18-may-2020" class="anchor"></a><small>Last updated: 18-May-2020</small>
<a href="#last-updated-19-may-2020" class="anchor"></a><small>Last updated: 19-May-2020</small>
</h2>
<div id="breaking" class="section level3">
<h3 class="hasAnchor">
<a href="#breaking" class="anchor"></a>Breaking</h3>
<ul>
<li>Removed previously deprecated function <code>p.symbol()</code> - it was replaced with <code><a href="../reference/p_symbol.html">p_symbol()</a></code>
<li>
<p>Removed code dependency on <strong>all</strong> R packages that this <code>AMR</code> package relied upon: <code>cleaner</code>, <code>crayon</code>, <code>data.table</code>, <code>dplyr</code>, <code>ggplot2</code>, <code>knitr</code>, <code>microbenchmark</code>, <code>pillar</code>, <code>R6</code>, <code>rlang</code>, <code>tidyr</code> and <code>vctrs</code>. This is a major code change, but will probably not be noticeable by most users.</p>
<p>Making this package independent on especially the tidyverse tremendously increases sustainability on the long term, since tidyverse functions change quite often. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.</p>
Negative effects of this change are:
<ul>
<li>Function <code>freq()</code> that was borrowed from the <code>cleaner</code> package was removed. Use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">cleaner::freq()</a></code>, or run <code><a href="https://rdrr.io/pkg/cleaner/man">library("cleaner")</a></code> before you use <code>freq()</code>.</li>
<li>Printing values of class <code>mo</code> or <code>ab</code> in a tibble will no longer be in colour.</li>
<li>All functions from the <code>mo_*</code> family (like <code><a href="../reference/mo_property.html">mo_name()</a></code> and <code><a href="../reference/mo_property.html">mo_gramstain()</a></code>) are noticeably slower when running on tens of thousands of rows.</li>
<li>For developers: classes <code>mo</code> and <code>ab</code> now both also inherit class <code>character</code>, to support any data transformation. This change invalidates code that checks for class length == 1.</li>
</ul>
</li>
</ul>
</div>
@ -260,7 +269,8 @@
<h3 class="hasAnchor">
<a href="#other" class="anchor"></a>Other</h3>
<ul>
<li>Removed dependency on <strong>all</strong> packages that were needed for the <code>AMR</code> package to work properly: <code>backports</code>, <code>crayon</code>, <code>data.table</code>, <code>dplyr</code>, <code>ggplot2</code>, <code>R6</code>, <code>rlang</code> and <code>tidyr</code>. This is a major code change, but will probably not be noticeable by users. Making this package independent on especially the tidyverse (packages <code>dplyr</code>, <code>ggplot2</code> and <code>tidyr</code>) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. The only dependencies that remained are for extending methods of other packages, like <code>pillar</code> and <code>vctrs</code> for printing and working with tibbles using our classes <code>mo</code> and <code>ab</code>.</li>
<li>Removed previously deprecated function <code>p.symbol()</code> - it was replaced with <code><a href="../reference/p_symbol.html">p_symbol()</a></code>
</li>
<li>Removed function <code>read.4d()</code>, that was only useful for reading from an old test database.</li>
</ul>
</div>
@ -531,7 +541,7 @@ For WHONET users, this means that all records/isolates with organism code <code>
<span class="co">#&gt; Warning message:</span>
<span class="co">#&gt; invalid microorganism code, NA generated</span></pre></div>
This is important, because a value like <code>"testvalue"</code> could never be understood by e.g. <code><a href="../reference/mo_property.html">mo_name()</a></code>, although the class would suggest a valid microbial code.</li>
<li>Function <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>), since creating frequency tables actually does not fit the scope of this package. The <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function still works, since it is re-exported from the <code>clean</code> package (which will be installed automatically upon updating this <code>AMR</code> package).</li>
<li>Function <code>freq()</code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>), since creating frequency tables actually does not fit the scope of this package. The <code>freq()</code> function still works, since it is re-exported from the <code>clean</code> package (which will be installed automatically upon updating this <code>AMR</code> package).</li>
<li><p>Renamed data set <code>septic_patients</code> to <code>example_isolates</code></p></li>
</ul>
</div>
@ -788,7 +798,7 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=Tra
<li>The <code><a href="../reference/age.html">age()</a></code> function gained a new parameter <code>exact</code> to determine ages with decimals</li>
<li>Removed deprecated functions <code>guess_mo()</code>, <code>guess_atc()</code>, <code>EUCAST_rules()</code>, <code>interpretive_reading()</code>, <code><a href="../reference/as.rsi.html">rsi()</a></code>
</li>
<li>Frequency tables (<code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>):
<li>Frequency tables (<code>freq()</code>):
<ul>
<li>speed improvement for microbial IDs</li>
<li>fixed factor level names for R Markdown</li>
@ -796,12 +806,12 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=Tra
<li>
<p>support for boxplots:</p>
<div class="sourceCode" id="cb16"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">age</span>) <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="no">age</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span>()
<span class="co"># grouped boxplots:</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="no">hospital_id</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">age</span>) <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="no">age</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span>()</pre></div>
</li>
</ul>
@ -812,7 +822,7 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=EUC
<li>Added ceftazidim intrinsic resistance to <em>Streptococci</em>
</li>
<li>Changed default settings for <code><a href="../reference/age_groups.html">age_groups()</a></code>, to let groups of fives and tens end with 100+ instead of 120+</li>
<li>Fix for <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> for when all values are <code>NA</code>
<li>Fix for <code>freq()</code> for when all values are <code>NA</code>
</li>
<li>Fix for <code><a href="../reference/first_isolate.html">first_isolate()</a></code> for when dates are missing</li>
<li>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
@ -1034,7 +1044,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
</ul>
</li>
<li>Frequency tables (<code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function):
<li>Frequency tables (<code>freq()</code> function):
<ul>
<li>
<p>Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:</p>
@ -1042,15 +1052,15 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<span class="co"># OLD WAY</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="kw">genus</span> <span class="kw">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="no">mo</span>)) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">genus</span>)
<span class="fu">freq</span>(<span class="no">genus</span>)
<span class="co"># NEW WAY</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="no">mo</span>))
<span class="fu">freq</span>(<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="no">mo</span>))
<span class="co"># Even supports grouping variables:</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="no">gender</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="no">mo</span>))</pre></div>
<span class="fu">freq</span>(<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="no">mo</span>))</pre></div>
</li>
<li>Header info is now available as a list, with the <code>header</code> function</li>
<li>The parameter <code>header</code> is now set to <code>TRUE</code> at default, even for markdown</li>
@ -1137,18 +1147,18 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<li>Using <code>portion_*</code> functions now throws a warning when total available isolate is below parameter <code>minimum</code>
</li>
<li>Functions <code>as.mo</code>, <code>as.rsi</code>, <code>as.mic</code>, <code>as.atc</code> and <code>freq</code> will not set package name as attribute anymore</li>
<li>Frequency tables - <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>:
<li>Frequency tables - <code>freq()</code>:
<ul>
<li>
<p>Support for grouping variables, test with:</p>
<div class="sourceCode" id="cb28"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="no">hospital_id</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">gender</span>)</pre></div>
<span class="fu">freq</span>(<span class="no">gender</span>)</pre></div>
</li>
<li>
<p>Support for (un)selecting columns:</p>
<div class="sourceCode" id="cb29"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">hospital_id</span>) <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="no">hospital_id</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(-<span class="no">count</span>, -<span class="no">cum_count</span>) <span class="co"># only get item, percent, cum_percent</span></pre></div>
</li>
<li>Check for <code><a href="https://hms.tidyverse.org/reference/Deprecated.html">hms::is.hms</a></code>
@ -1327,11 +1337,11 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<li>
<p>Support for types (classes) list and matrix for <code>freq</code></p>
<div class="sourceCode" id="cb36"><pre class="r"><span class="no">my_matrix</span> <span class="kw">=</span> <span class="fu"><a href="https://rdrr.io/r/base/with.html">with</a></span>(<span class="no">septic_patients</span>, <span class="fu"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="no">age</span>, <span class="no">gender</span>), <span class="kw">ncol</span> <span class="kw">=</span> <span class="fl">2</span>))
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">my_matrix</span>)</pre></div>
<span class="fu">freq</span>(<span class="no">my_matrix</span>)</pre></div>
<p>For lists, subsetting is possible:</p>
<div class="sourceCode" id="cb37"><pre class="r"><span class="no">my_list</span> <span class="kw">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="kw">age</span> <span class="kw">=</span> <span class="no">septic_patients</span>$<span class="no">age</span>, <span class="kw">gender</span> <span class="kw">=</span> <span class="no">septic_patients</span>$<span class="no">gender</span>)
<span class="no">my_list</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">age</span>)
<span class="no">my_list</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">gender</span>)</pre></div>
<span class="no">my_list</span> <span class="kw">%&gt;%</span> <span class="fu">freq</span>(<span class="no">age</span>)
<span class="no">my_list</span> <span class="kw">%&gt;%</span> <span class="fu">freq</span>(<span class="no">gender</span>)</pre></div>
</li>
</ul>
</div>
@ -1405,13 +1415,13 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<ul>
<li>A vignette to explain its usage</li>
<li>Support for <code>rsi</code> (antimicrobial resistance) to use as input</li>
<li>Support for <code>table</code> to use as input: <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(table(x, y))</a></code>
<li>Support for <code>table</code> to use as input: <code>freq(table(x, y))</code>
</li>
<li>Support for existing functions <code>hist</code> and <code>plot</code> to use a frequency table as input: <code><a href="https://rdrr.io/r/graphics/hist.html">hist(freq(df$age))</a></code>
</li>
<li>Support for <code>as.vector</code>, <code>as.data.frame</code>, <code>as_tibble</code> and <code>format</code>
</li>
<li>Support for quasiquotation: <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(mydata, mycolumn)</a></code> is the same as <code>mydata %&gt;% freq(mycolumn)</code>
<li>Support for quasiquotation: <code>freq(mydata, mycolumn)</code> is the same as <code>mydata %&gt;% freq(mycolumn)</code>
</li>
<li>Function <code>top_freq</code> function to return the top/below <em>n</em> items as vector</li>
<li>Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)</li>

View File

@ -10,7 +10,7 @@ articles:
WHONET: WHONET.html
benchmarks: benchmarks.html
resistance_predict: resistance_predict.html
last_built: 2020-05-18T11:59Z
last_built: 2020-05-19T10:08Z
urls:
reference: https://msberends.gitlab.io/AMR/reference
article: https://msberends.gitlab.io/AMR/articles

View File

@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9011</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9012</span>
</span>
</div>
@ -583,18 +583,6 @@
<p><code><a href="like.html">like()</a></code> <code><a href="like.html">`%like%`</a></code> <code><a href="like.html">`%like_case%`</a></code> </p>
</td>
<td><p>Pattern Matching</p></td>
</tr><tr>
<td>
<p><code><a href="reexports.html">reexports</a></code> </p>
</td>
<td><p>Objects exported from other packages</p></td>
</tr><tr>
<td>
<p><code><a href="AMR-tidyverse.html">scale_type.mo()</a></code> <code><a href="AMR-tidyverse.html">scale_type.ab()</a></code> <code><a href="AMR-tidyverse.html">vec_ptype2.mo()</a></code> <code><a href="AMR-tidyverse.html">vec_cast.mo()</a></code> <code><a href="AMR-tidyverse.html">vec_ptype2.ab()</a></code> <code><a href="AMR-tidyverse.html">vec_cast.ab()</a></code> </p>
</td>
<td><p>Methods for tidyverse</p></td>
</tr>
</tbody><tbody>
<tr>

View File

@ -6,9 +6,6 @@
<url>
<loc>https://msberends.gitlab.io/AMR/reference/AMR-deprecated.html</loc>
</url>
<url>
<loc>https://msberends.gitlab.io/AMR/reference/AMR-tidyverse.html</loc>
</url>
<url>
<loc>https://msberends.gitlab.io/AMR/reference/AMR.html</loc>
</url>
@ -132,9 +129,6 @@
<url>
<loc>https://msberends.gitlab.io/AMR/reference/proportion.html</loc>
</url>
<url>
<loc>https://msberends.gitlab.io/AMR/reference/reexports.html</loc>
</url>
<url>
<loc>https://msberends.gitlab.io/AMR/reference/resistance_predict.html</loc>
</url>

View File

@ -12,7 +12,7 @@
After installing this package, R knows [**~70,000 distinct microbial species**](./reference/microorganisms.html) and all [**~550 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code (including ATC, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
We created this package for both routine data analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is [actively maintained](./news) and is free software (see [Copyright](#copyright)).
We created this package for both routine data analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is [actively maintained](./news) and is free software (see [Copyright](#copyright)). It is fully independent on any other R package and only requires R version 3.0.0 (April 2013) or higher to run.
<div class="main-content">
<p>

View File

@ -1,41 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tidyverse.R
\name{AMR-tidyverse}
\alias{AMR-tidyverse}
\alias{scale_type.mo}
\alias{scale_type.ab}
\alias{vec_ptype2.mo}
\alias{vec_cast.mo}
\alias{vec_ptype2.ab}
\alias{vec_cast.ab}
\title{Methods for tidyverse}
\usage{
scale_type.mo(x)
scale_type.ab(x)
vec_ptype2.mo(x, y, ...)
vec_cast.mo(x, to, ...)
vec_ptype2.ab(x, y, ...)
vec_cast.ab(x, to, ...)
}
\description{
These methods are needed to support methods used by the tidyverse, like joining and transforming data, with new classes that come with this package.
}
\section{Stable lifecycle}{
\if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:5px} \cr}
The \link[AMR:lifecycle]{lifecycle} of this function is \strong{stable}. In a stable function, we are largely happy with the unlying code, and major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; we will avoid removing arguments or changing the meaning of existing arguments.
If the unlying code needs breaking changes, they will occur gradually. To begin with, the function or argument will be deprecated; it will continue to work but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
}
\section{Read more on our website!}{
On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR analysis, the \href{https://msberends.gitlab.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.gitlab.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
}
\keyword{internal}

View File

@ -1,16 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/freq.R
\docType{import}
\name{reexports}
\alias{reexports}
\alias{freq}
\title{Objects exported from other packages}
\keyword{internal}
\description{
These objects are imported from other packages. Follow the links
below to see their documentation.
\describe{
\item{cleaner}{\code{\link[cleaner]{freq}}}
}}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -34,8 +34,8 @@ test_that("as.ab works", {
"Romycin"))),
rep("ERY", 10))
expect_identical(class(as.ab("amox")), "ab")
expect_identical(class(pull(antibiotics, ab)), "ab")
expect_identical(class(as.ab("amox")), c("ab", "character"))
expect_identical(class(pull(antibiotics, ab)), c("ab", "character"))
expect_true(is.ab(as.ab("amox")))
expect_output(print(as.ab("amox")))
expect_output(print(data.frame(a = as.ab("amox"))))
@ -46,8 +46,6 @@ test_that("as.ab works", {
expect_output(print(as.ab("amox")))
expect_identical(class(pull(antibiotics, ab)), "ab")
expect_equal(as.character(as.ab("Phloxapen")),
"FLC")

View File

@ -27,9 +27,9 @@ test_that("data sets are valid", {
# IDs should always be unique
expect_identical(nrow(microorganisms), length(unique(microorganisms$mo)))
expect_identical(class(microorganisms$mo), "mo")
expect_identical(class(microorganisms$mo), c("mo", "character"))
expect_identical(nrow(antibiotics), length(unique(antibiotics$ab)))
expect_identical(class(antibiotics$ab), "ab")
expect_identical(class(antibiotics$ab), c("ab", "character"))
# check cross table reference
expect_true(all(microorganisms.codes$mo %in% microorganisms$mo))

View File

@ -1,29 +0,0 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# (c) 2018-2020 Berends MS, Luz CF et al. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# #
# We created this package for both routine data analysis and academic #
# research and it 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.gitlab.io/AMR. #
# ==================================================================== #
context("extended.R")
test_that("extensions work", {
expect_identical(scale_type.mo(), "discrete")
expect_identical(scale_type.ab(), "discrete")
})