1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 02:03:04 +02:00
This commit is contained in:
2020-05-28 16:48:55 +02:00
parent d9a4b0bcaf
commit b44e2c9202
82 changed files with 448 additions and 517 deletions

14
R/ab.R
View File

@ -343,7 +343,7 @@ is.ab <- function(x) {
inherits(x, "ab")
}
#' @exportMethod print.ab
#' @method print ab
#' @export
#' @noRd
print.ab <- function(x, ...) {
@ -351,7 +351,7 @@ print.ab <- function(x, ...) {
print(as.character(x), quote = FALSE)
}
#' @exportMethod as.data.frame.ab
#' @method as.data.frame ab
#' @export
#' @noRd
as.data.frame.ab <- function(x, ...) {
@ -362,7 +362,7 @@ as.data.frame.ab <- function(x, ...) {
as.data.frame.vector(as.ab(x), ...)
}
}
#' @exportMethod [.ab
#' @method [ ab
#' @export
#' @noRd
"[.ab" <- function(x, ...) {
@ -370,7 +370,7 @@ as.data.frame.ab <- function(x, ...) {
attributes(y) <- attributes(x)
y
}
#' @exportMethod [[.ab
#' @method [[ ab
#' @export
#' @noRd
"[[.ab" <- function(x, ...) {
@ -378,7 +378,7 @@ as.data.frame.ab <- function(x, ...) {
attributes(y) <- attributes(x)
y
}
#' @exportMethod [<-.ab
#' @method [<- ab
#' @export
#' @noRd
"[<-.ab" <- function(i, j, ..., value) {
@ -386,7 +386,7 @@ as.data.frame.ab <- function(x, ...) {
attributes(y) <- attributes(i)
class_integrity_check(y, "antimicrobial code", antibiotics$ab)
}
#' @exportMethod [[<-.ab
#' @method [[<- ab
#' @export
#' @noRd
"[[<-.ab" <- function(i, j, ..., value) {
@ -394,7 +394,7 @@ as.data.frame.ab <- function(x, ...) {
attributes(y) <- attributes(i)
class_integrity_check(y, "antimicrobial code", antibiotics$ab)
}
#' @exportMethod c.ab
#' @method c ab
#' @export
#' @noRd
c.ab <- function(x, ...) {

View File

@ -107,7 +107,7 @@ bug_drug_combinations <- function(x,
structure(.Data = out, class = c("bug_drug_combinations", class(x)))
}
#' @exportMethod format.bug_drug_combinations
#' @method format bug_drug_combinations
#' @export
#' @rdname bug_drug_combinations
format.bug_drug_combinations <- function(x,
@ -218,7 +218,7 @@ format.bug_drug_combinations <- function(x,
y
}
#' @exportMethod print.bug_drug_combinations
#' @method print bug_drug_combinations
#' @export
print.bug_drug_combinations <- function(x, ...) {
print(as.data.frame(x, stringsAsFactors = FALSE))

View File

@ -107,7 +107,7 @@ catalogue_of_life_version <- function() {
class = c("catalogue_of_life_version", "list"))
}
#' @exportMethod print.catalogue_of_life_version
#' @method print catalogue_of_life_version
#' @export
#' @noRd
print.catalogue_of_life_version <- function(x, ...) {

View File

@ -95,7 +95,7 @@ is.disk <- function(x) {
inherits(x, "disk")
}
#' @exportMethod print.disk
#' @method print disk
#' @export
#' @noRd
print.disk <- function(x, ...) {
@ -103,7 +103,7 @@ print.disk <- function(x, ...) {
print(as.integer(x), quote = FALSE)
}
#' @exportMethod [.disk
#' @method [ disk
#' @export
#' @noRd
"[.disk" <- function(x, ...) {
@ -111,7 +111,7 @@ print.disk <- function(x, ...) {
attributes(y) <- attributes(x)
y
}
#' @exportMethod [[.disk
#' @method [[ disk
#' @export
#' @noRd
"[[.disk" <- function(x, ...) {
@ -119,7 +119,7 @@ print.disk <- function(x, ...) {
attributes(y) <- attributes(x)
y
}
#' @exportMethod [<-.disk
#' @method [<- disk
#' @export
#' @noRd
"[<-.disk" <- function(i, j, ..., value) {
@ -128,7 +128,7 @@ print.disk <- function(x, ...) {
attributes(y) <- attributes(i)
y
}
#' @exportMethod [[<-.disk
#' @method [[<- disk
#' @export
#' @noRd
"[[<-.disk" <- function(i, j, ..., value) {
@ -137,7 +137,7 @@ print.disk <- function(x, ...) {
attributes(y) <- attributes(i)
y
}
#' @exportMethod c.disk
#' @method c disk
#' @export
#' @noRd
c.disk <- function(x, ...) {

View File

@ -25,7 +25,6 @@
#' @inheritSection lifecycle Questioning lifecycle
#' @param x a vector of values, a [`matrix`] or a [`data.frame`]
#' @param na.rm a logical value indicating whether `NA` values should be stripped before the computation proceeds.
#' @exportMethod kurtosis
#' @seealso [skewness()]
#' @rdname kurtosis
#' @inheritSection AMR Read more on our website!
@ -34,7 +33,7 @@ kurtosis <- function(x, na.rm = FALSE) {
UseMethod("kurtosis")
}
#' @exportMethod kurtosis.default
#' @method kurtosis default
#' @rdname kurtosis
#' @export
kurtosis.default <- function(x, na.rm = FALSE) {
@ -47,14 +46,14 @@ kurtosis.default <- function(x, na.rm = FALSE) {
(base::sum((x - base::mean(x, na.rm = na.rm))^2, na.rm = na.rm)^2)
}
#' @exportMethod kurtosis.matrix
#' @method kurtosis matrix
#' @rdname kurtosis
#' @export
kurtosis.matrix <- function(x, na.rm = FALSE) {
base::apply(x, 2, kurtosis.default, na.rm = na.rm)
}
#' @exportMethod kurtosis.data.frame
#' @method kurtosis data.frame
#' @rdname kurtosis
#' @export
kurtosis.data.frame <- function(x, na.rm = FALSE) {

26
R/mic.R
View File

@ -140,28 +140,28 @@ is.mic <- function(x) {
inherits(x, "mic")
}
#' @exportMethod as.double.mic
#' @method as.double mic
#' @export
#' @noRd
as.double.mic <- function(x, ...) {
as.double(gsub("(<|=|>)+", "", as.character(x)))
}
#' @exportMethod as.integer.mic
#' @method as.integer mic
#' @export
#' @noRd
as.integer.mic <- function(x, ...) {
as.integer(gsub("(<|=|>)+", "", as.character(x)))
}
#' @exportMethod as.numeric.mic
#' @method as.numeric mic
#' @export
#' @noRd
as.numeric.mic <- function(x, ...) {
as.numeric(gsub("(<|=|>)+", "", as.character(x)))
}
#' @exportMethod droplevels.mic
#' @method droplevels mic
#' @export
#' @noRd
droplevels.mic <- function(x, exclude = ifelse(anyNA(levels(x)), NULL, NA), ...) {
@ -170,7 +170,7 @@ droplevels.mic <- function(x, exclude = ifelse(anyNA(levels(x)), NULL, NA), ...)
x
}
#' @exportMethod print.mic
#' @method print mic
#' @export
#' @noRd
print.mic <- function(x, ...) {
@ -178,7 +178,7 @@ print.mic <- function(x, ...) {
print(as.character(x), quote = FALSE)
}
#' @exportMethod summary.mic
#' @method summary mic
#' @export
#' @noRd
summary.mic <- function(object, ...) {
@ -194,7 +194,7 @@ summary.mic <- function(object, ...) {
)
}
#' @exportMethod plot.mic
#' @method plot mic
#' @export
#' @importFrom graphics barplot axis par
#' @noRd
@ -213,7 +213,7 @@ plot.mic <- function(x,
axis(2, seq(0, max(table(droplevels.factor(x)))))
}
#' @exportMethod barplot.mic
#' @method barplot mic
#' @export
#' @importFrom graphics barplot axis
#' @noRd
@ -232,7 +232,7 @@ barplot.mic <- function(height,
axis(2, seq(0, max(table(droplevels.factor(height)))))
}
#' @exportMethod [.mic
#' @method [ mic
#' @export
#' @noRd
"[.mic" <- function(x, ...) {
@ -240,7 +240,7 @@ barplot.mic <- function(height,
attributes(y) <- attributes(x)
y
}
#' @exportMethod [[.mic
#' @method [[ mic
#' @export
#' @noRd
"[[.mic" <- function(x, ...) {
@ -248,7 +248,7 @@ barplot.mic <- function(height,
attributes(y) <- attributes(x)
y
}
#' @exportMethod [<-.mic
#' @method [<- mic
#' @export
#' @noRd
"[<-.mic" <- function(i, j, ..., value) {
@ -257,7 +257,7 @@ barplot.mic <- function(height,
attributes(y) <- attributes(i)
y
}
#' @exportMethod [[<-.mic
#' @method [[<- mic
#' @export
#' @noRd
"[[<-.mic" <- function(i, j, ..., value) {
@ -266,7 +266,7 @@ barplot.mic <- function(height,
attributes(y) <- attributes(i)
y
}
#' @exportMethod c.mic
#' @method c mic
#' @export
#' @noRd
c.mic <- function(x, ...) {

20
R/mo.R
View File

@ -1566,7 +1566,7 @@ format_uncertainty_as_df <- function(uncertainty_level,
df
}
#' @exportMethod print.mo
#' @method print mo
#' @export
#' @noRd
print.mo <- function(x, ...) {
@ -1577,7 +1577,7 @@ print.mo <- function(x, ...) {
print.default(x, quote = FALSE)
}
#' @exportMethod summary.mo
#' @method summary mo
#' @export
#' @noRd
summary.mo <- function(object, ...) {
@ -1593,7 +1593,7 @@ summary.mo <- function(object, ...) {
"#3" = top_3[3])
}
#' @exportMethod as.data.frame.mo
#' @method as.data.frame mo
#' @export
#' @noRd
as.data.frame.mo <- function(x, ...) {
@ -1605,7 +1605,7 @@ as.data.frame.mo <- function(x, ...) {
}
}
#' @exportMethod [.mo
#' @method [ mo
#' @export
#' @noRd
"[.mo" <- function(x, ...) {
@ -1613,7 +1613,7 @@ as.data.frame.mo <- function(x, ...) {
attributes(y) <- attributes(x)
y
}
#' @exportMethod [[.mo
#' @method [[ mo
#' @export
#' @noRd
"[[.mo" <- function(x, ...) {
@ -1621,7 +1621,7 @@ as.data.frame.mo <- function(x, ...) {
attributes(y) <- attributes(x)
y
}
#' @exportMethod [<-.mo
#' @method [<- mo
#' @export
#' @noRd
"[<-.mo" <- function(i, j, ..., value) {
@ -1631,7 +1631,7 @@ as.data.frame.mo <- function(x, ...) {
class_integrity_check(y, "microorganism code", c(as.character(microorganisms$mo),
as.character(microorganisms.translation$mo_old)))
}
#' @exportMethod [[<-.mo
#' @method [[<- mo
#' @export
#' @noRd
"[[<-.mo" <- function(i, j, ..., value) {
@ -1641,7 +1641,7 @@ as.data.frame.mo <- function(x, ...) {
class_integrity_check(y, "microorganism code", c(as.character(microorganisms$mo),
as.character(microorganisms.translation$mo_old)))
}
#' @exportMethod c.mo
#' @method c mo
#' @export
#' @noRd
c.mo <- function(x, ...) {
@ -1668,7 +1668,7 @@ mo_uncertainties <- function() {
class = c("mo_uncertainties", "data.frame"))
}
#' @exportMethod print.mo_uncertainties
#' @method print mo_uncertainties
#' @export
#' @noRd
print.mo_uncertainties <- function(x, ...) {
@ -1717,7 +1717,7 @@ mo_renamed <- function() {
class = c("mo_renamed", "data.frame"))
}
#' @exportMethod print.mo_renamed
#' @method print mo_renamed
#' @export
#' @noRd
print.mo_renamed <- function(x, ...) {

View File

@ -302,7 +302,7 @@ resistance_predict <- function(x,
#' @export
rsi_predict <- resistance_predict
#' @exportMethod plot.mic
#' @method plot resistance_predict
#' @export
#' @importFrom graphics axis arrows points
#' @rdname resistance_predict

16
R/rsi.R
View File

@ -529,7 +529,7 @@ is.rsi.eligible <- function(x, threshold = 0.05) {
}
}
#' @exportMethod print.rsi
#' @method print rsi
#' @export
#' @noRd
print.rsi <- function(x, ...) {
@ -537,7 +537,7 @@ print.rsi <- function(x, ...) {
print(as.character(x), quote = FALSE)
}
#' @exportMethod droplevels.rsi
#' @method droplevels rsi
#' @export
#' @noRd
droplevels.rsi <- function(x, exclude = if (anyNA(levels(x))) NULL else NA, ...) {
@ -546,7 +546,7 @@ droplevels.rsi <- function(x, exclude = if (anyNA(levels(x))) NULL else NA, ...)
x
}
#' @exportMethod summary.rsi
#' @method summary rsi
#' @export
#' @noRd
summary.rsi <- function(object, ...) {
@ -561,7 +561,7 @@ summary.rsi <- function(object, ...) {
)
}
#' @exportMethod plot.rsi
#' @method plot rsi
#' @export
#' @importFrom graphics text axis
#' @noRd
@ -618,7 +618,7 @@ plot.rsi <- function(x,
}
#' @exportMethod barplot.rsi
#' @method barplot rsi
#' @export
#' @importFrom graphics barplot axis par
#' @noRd
@ -652,7 +652,7 @@ barplot.rsi <- function(height,
}
}
#' @exportMethod [<-.rsi
#' @method [<- rsi
#' @export
#' @noRd
"[<-.rsi" <- function(i, j, ..., value) {
@ -661,7 +661,7 @@ barplot.rsi <- function(height,
attributes(y) <- attributes(i)
y
}
#' @exportMethod [[<-.rsi
#' @method [[<- rsi
#' @export
#' @noRd
"[[<-.rsi" <- function(i, j, ..., value) {
@ -670,7 +670,7 @@ barplot.rsi <- function(height,
attributes(y) <- attributes(i)
y
}
#' @exportMethod c.rsi
#' @method c rsi
#' @export
#' @noRd
c.rsi <- function(x, ...) {

View File

@ -27,7 +27,6 @@
#' @inheritSection lifecycle Questioning lifecycle
#' @param x a vector of values, a [`matrix`] or a [`data.frame`]
#' @param na.rm a logical value indicating whether `NA` values should be stripped before the computation proceeds.
#' @exportMethod skewness
#' @seealso [kurtosis()]
#' @rdname skewness
#' @inheritSection AMR Read more on our website!
@ -36,7 +35,7 @@ skewness <- function(x, na.rm = FALSE) {
UseMethod("skewness")
}
#' @exportMethod skewness.default
#' @method skewness default
#' @rdname skewness
#' @export
skewness.default <- function(x, na.rm = FALSE) {
@ -48,14 +47,14 @@ skewness.default <- function(x, na.rm = FALSE) {
(base::sum((x - base::mean(x))^3) / n) / (base::sum((x - base::mean(x)) ^ 2) / n) ^ (3 / 2)
}
#' @exportMethod skewness.matrix
#' @method skewness matrix
#' @rdname skewness
#' @export
skewness.matrix <- function(x, na.rm = FALSE) {
base::apply(x, 2, skewness.default, na.rm = na.rm)
}
#' @exportMethod skewness.data.frame
#' @method skewness data.frame
#' @rdname skewness
#' @export
skewness.data.frame <- function(x, na.rm = FALSE) {