Browse Source

v1.2.0

main v1.2.0
parent
commit
b44e2c9202
  1. 2
      DESCRIPTION
  2. 55
      NAMESPACE
  3. 4
      NEWS.md
  4. 14
      R/ab.R
  5. 4
      R/bug_drug_combinations.R
  6. 2
      R/catalogue_of_life.R
  7. 12
      R/disk.R
  8. 7
      R/kurtosis.R
  9. 26
      R/mic.R
  10. 20
      R/mo.R
  11. 2
      R/resistance_predict.R
  12. 16
      R/rsi.R
  13. 7
      R/skewness.R
  14. 4
      cran-comments.md
  15. 2
      docs/404.html
  16. 2
      docs/LICENSE-text.html
  17. 387
      docs/articles/AMR.html
  18. BIN
      docs/articles/AMR_files/figure-html/plot 1-1.png
  19. BIN
      docs/articles/AMR_files/figure-html/plot 3-1.png
  20. BIN
      docs/articles/AMR_files/figure-html/plot 4-1.png
  21. BIN
      docs/articles/AMR_files/figure-html/plot 5-1.png
  22. 6
      docs/articles/EUCAST.html
  23. 56
      docs/articles/MDR.html
  24. 2
      docs/articles/PCA.html
  25. 10
      docs/articles/SPSS.html
  26. 18
      docs/articles/WHONET.html
  27. 86
      docs/articles/benchmarks.html
  28. BIN
      docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png
  29. BIN
      docs/articles/benchmarks_files/figure-html/unnamed-chunk-6-1.png
  30. 2
      docs/articles/index.html
  31. 2
      docs/articles/resistance_predict.html
  32. 2
      docs/authors.html
  33. 2
      docs/index.html
  34. 13
      docs/news/index.html
  35. 2
      docs/pkgdown.yml
  36. 2
      docs/reference/AMR-deprecated.html
  37. 4
      docs/reference/AMR.html
  38. 4
      docs/reference/WHOCC.html
  39. 4
      docs/reference/WHONET.html
  40. 2
      docs/reference/ab_property.html
  41. 2
      docs/reference/age.html
  42. 2
      docs/reference/age_groups.html
  43. 2
      docs/reference/antibiotics.html
  44. 2
      docs/reference/as.ab.html
  45. 2
      docs/reference/as.disk.html
  46. 2
      docs/reference/as.mic.html
  47. 2
      docs/reference/as.mo.html
  48. 2
      docs/reference/as.rsi.html
  49. 2
      docs/reference/atc_online.html
  50. 2
      docs/reference/availability.html
  51. 2
      docs/reference/bug_drug_combinations.html
  52. 2
      docs/reference/catalogue_of_life.html
  53. 2
      docs/reference/catalogue_of_life_version.html
  54. 2
      docs/reference/count.html
  55. 2
      docs/reference/eucast_rules.html
  56. 4
      docs/reference/example_isolates.html
  57. 4
      docs/reference/example_isolates_unclean.html
  58. 2
      docs/reference/filter_ab_class.html
  59. 2
      docs/reference/first_isolate.html
  60. 2
      docs/reference/g.test.html
  61. 2
      docs/reference/ggplot_pca.html
  62. 2
      docs/reference/ggplot_rsi.html
  63. 2
      docs/reference/guess_ab_col.html
  64. 2
      docs/reference/index.html
  65. 2
      docs/reference/join.html
  66. 2
      docs/reference/key_antibiotics.html
  67. 2
      docs/reference/kurtosis.html
  68. 2
      docs/reference/lifecycle.html
  69. 2
      docs/reference/like.html
  70. 2
      docs/reference/mdro.html
  71. 2
      docs/reference/microorganisms.codes.html
  72. 2
      docs/reference/microorganisms.html
  73. 2
      docs/reference/microorganisms.old.html
  74. 2
      docs/reference/mo_property.html
  75. 2
      docs/reference/mo_source.html
  76. 2
      docs/reference/p_symbol.html
  77. 2
      docs/reference/pca.html
  78. 2
      docs/reference/proportion.html
  79. 2
      docs/reference/resistance_predict.html
  80. 4
      docs/reference/rsi_translation.html
  81. 2
      docs/reference/skewness.html
  82. 2
      docs/reference/translate.html

2
DESCRIPTION

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Package: AMR
Version: 1.1.0.9021
Version: 1.2.0
Date: 2020-05-28
Title: Antimicrobial Resistance Analysis
Authors@R: c(

55
NAMESPACE

@ -195,61 +195,6 @@ export(set_mo_source) @@ -195,61 +195,6 @@ export(set_mo_source)
export(skewness)
export(susceptibility)
export(theme_rsi)
exportMethods("[.ab")
exportMethods("[.disk")
exportMethods("[.mic")
exportMethods("[.mo")
exportMethods("[<-.ab")
exportMethods("[<-.disk")
exportMethods("[<-.mic")
exportMethods("[<-.mo")
exportMethods("[<-.rsi")
exportMethods("[[.ab")
exportMethods("[[.disk")
exportMethods("[[.mic")
exportMethods("[[.mo")
exportMethods("[[<-.ab")
exportMethods("[[<-.disk")
exportMethods("[[<-.mic")
exportMethods("[[<-.mo")
exportMethods("[[<-.rsi")
exportMethods(as.data.frame.ab)
exportMethods(as.data.frame.mo)
exportMethods(as.double.mic)
exportMethods(as.integer.mic)
exportMethods(as.numeric.mic)
exportMethods(barplot.mic)
exportMethods(barplot.rsi)
exportMethods(c.ab)
exportMethods(c.disk)
exportMethods(c.mic)
exportMethods(c.mo)
exportMethods(c.rsi)
exportMethods(droplevels.mic)
exportMethods(droplevels.rsi)
exportMethods(format.bug_drug_combinations)
exportMethods(kurtosis)
exportMethods(kurtosis.data.frame)
exportMethods(kurtosis.default)
exportMethods(kurtosis.matrix)
exportMethods(plot.mic)
exportMethods(plot.rsi)
exportMethods(print.ab)
exportMethods(print.bug_drug_combinations)
exportMethods(print.catalogue_of_life_version)
exportMethods(print.disk)
exportMethods(print.mic)
exportMethods(print.mo)
exportMethods(print.mo_renamed)
exportMethods(print.mo_uncertainties)
exportMethods(print.rsi)
exportMethods(skewness)
exportMethods(skewness.data.frame)
exportMethods(skewness.default)
exportMethods(skewness.matrix)
exportMethods(summary.mic)
exportMethods(summary.mo)
exportMethods(summary.rsi)
importFrom(graphics,arrows)
importFrom(graphics,axis)
importFrom(graphics,barplot)

4
NEWS.md

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
# AMR 1.1.0.9021
## <small>Last updated: 28-May-2020</small>
# AMR 1.2.0
### Breaking
* Removed code dependency on all other R packages, making this package fully independent of the development process of others. This is a major code change, but will probably not be noticeable by most users.

14
R/ab.R

@ -343,7 +343,7 @@ is.ab <- function(x) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) {

4
R/bug_drug_combinations.R

@ -107,7 +107,7 @@ bug_drug_combinations <- function(x, @@ -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, @@ -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))

2
R/catalogue_of_life.R

@ -107,7 +107,7 @@ catalogue_of_life_version <- function() { @@ -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, ...) {

12
R/disk.R

@ -95,7 +95,7 @@ is.disk <- function(x) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) {

7
R/kurtosis.R

@ -25,7 +25,6 @@ @@ -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) { @@ -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) { @@ -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

@ -140,28 +140,28 @@ is.mic <- function(x) { @@ -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), ...) @@ -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, ...) { @@ -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, ...) { @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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

@ -1566,7 +1566,7 @@ format_uncertainty_as_df <- function(uncertainty_level, @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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, ...) { @@ -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() { @@ -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() { @@ -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, ...) {

2
R/resistance_predict.R

@ -302,7 +302,7 @@ resistance_predict <- function(x, @@ -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

@ -529,7 +529,7 @@ is.rsi.eligible <- function(x, threshold = 0.05) { @@ -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, ...) { @@ -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, ...) @@ -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, ...) { @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, ...) {

7
R/skewness.R

@ -27,7 +27,6 @@ @@ -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) { @@ -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) { @@ -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) {

4
cran-comments.md

@ -1,5 +1,3 @@ @@ -1,5 +1,3 @@
* Although the previous release (1.0.1) is from 2020-02-23, this updates provides support for the upcoming dplyr 1.0.0 which is used (and relied upon) by probably all our users.
* For this specific version, otherwise nothing to mention.
* For this specific version, nothing to mention.
* Since version 0.3.0, CHECK returns a NOTE for having a data directory over 3 MB. This is needed to offer users reference data for the complete taxonomy of microorganisms - one of the most important features of this package.

2
docs/404.html

@ -81,7 +81,7 @@ @@ -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.9021</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0</span>
</span>
</div>

2
docs/LICENSE-text.html

@ -81,7 +81,7 @@ @@ -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.9021</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0</span>
</span>
</div>

387
docs/articles/AMR.html

@ -39,7 +39,7 @@ @@ -39,7 +39,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.9021</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0</span>
</span>
</div>
@ -336,21 +336,21 @@ @@ -336,21 +336,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2015-07-23</td>
<td align="center">Z5</td>
<td align="center">Hospital B</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">2013-12-18</td>
<td align="center">P10</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2017-01-21</td>
<td align="center">D6</td>
<td align="center">2010-07-10</td>
<td align="center">K6</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -358,32 +358,32 @@ @@ -358,32 +358,32 @@
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2014-05-20</td>
<td align="center">Y10</td>
<td align="center">Hospital A</td>
<td align="center">2014-12-14</td>
<td align="center">F6</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2017-11-02</td>
<td align="center">M10</td>
<td align="center">2010-12-31</td>
<td align="center">N8</td>
<td align="center">Hospital D</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2014-08-26</td>
<td align="center">B4</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">2010-11-24</td>
<td align="center">M5</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -391,11 +391,11 @@ @@ -391,11 +391,11 @@
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2013-05-29</td>
<td align="center">R3</td>
<td align="center">Hospital B</td>
<td align="center">2010-10-07</td>
<td align="center">Z8</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
@ -432,16 +432,16 @@ Longest: 1</p> @@ -432,16 +432,16 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,518</td>
<td align="right">52.59%</td>
<td align="right">10,518</td>
<td align="right">52.59%</td>
<td align="right">10,397</td>
<td align="right">51.99%</td>
<td align="right">10,397</td>
<td align="right">51.99%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,482</td>
<td align="right">47.41%</td>
<td align="right">9,603</td>
<td align="right">48.02%</td>
<td align="right">20,000</td>
<td align="right">100.00%</td>
</tr>
@ -491,7 +491,7 @@ Longest: 1</p> @@ -491,7 +491,7 @@ Longest: 1</p>
<div id="first-weighted-isolates" class="section level2">
<h2 class="hasAnchor">
<a href="#first-weighted-isolates" class="anchor"></a>First <em>weighted</em> isolates</h2>
<p>We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient P10, sorted on date:</p>
<p>We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient U2, sorted on date:</p>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -507,10 +507,10 @@ Longest: 1</p> @@ -507,10 +507,10 @@ Longest: 1</p>
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-22</td>
<td align="center">P10</td>
<td align="center">2010-03-30</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -518,43 +518,43 @@ Longest: 1</p> @@ -518,43 +518,43 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-02-24</td>
<td align="center">P10</td>
<td align="center">2010-07-30</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-03-10</td>
<td align="center">P10</td>
<td align="center">2010-10-14</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-03-25</td>
<td align="center">P10</td>
<td align="center">2010-12-17</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-04-30</td>
<td align="center">P10</td>
<td align="center">2011-02-17</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -562,62 +562,62 @@ Longest: 1</p> @@ -562,62 +562,62 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-05-05</td>
<td align="center">P10</td>
<td align="center">2011-03-17</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-05-19</td>
<td align="center">P10</td>
<td align="center">2011-06-10</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2010-05-27</td>
<td align="center">P10</td>
<td align="center">2011-07-17</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2010-10-01</td>
<td align="center">P10</td>
<td align="center">2011-08-08</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2010-11-19</td>
<td align="center">P10</td>
<td align="center">2011-08-21</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
</tbody>
</table>
<p>Only 1 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
<p>Only 2 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
<p>If a column exists with a name like ‘key(…)ab’ the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p>
<div class="sourceCode" id="cb18"><html><body><pre class="r"><span class="no">data</span> <span class="kw">&lt;-</span> <span class="no">data</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="kw">keyab</span> <span class="kw">=</span> <span class="fu"><a href="../reference/key_antibiotics.html">key_antibiotics</a></span>(<span class="no">.</span>)) <span class="kw">%&gt;%</span>
@ -643,10 +643,10 @@ Longest: 1</p> @@ -643,10 +643,10 @@ Longest: 1</p>
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-22</td>
<td align="center">P10</td>
<td align="center">2010-03-30</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -655,46 +655,46 @@ Longest: 1</p> @@ -655,46 +655,46 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-02-24</td>
<td align="center">P10</td>
<td align="center">2010-07-30</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-03-10</td>
<td align="center">P10</td>
<td align="center">2010-10-14</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-03-25</td>
<td align="center">P10</td>
<td align="center">2010-12-17</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-04-30</td>
<td align="center">P10</td>
<td align="center">2011-02-17</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -703,71 +703,71 @@ Longest: 1</p> @@ -703,71 +703,71 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-05-05</td>
<td align="center">P10</td>
<td align="center">2011-03-17</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-05-19</td>
<td align="center">P10</td>
<td align="center">2011-06-10</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2010-05-27</td>
<td align="center">P10</td>
<td align="center">2011-07-17</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2010-10-01</td>
<td align="center">P10</td>
<td align="center">2011-08-08</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2010-11-19</td>
<td align="center">P10</td>
<td align="center">2011-08-21</td>
<td align="center">U2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
</tbody>
</table>
<p>Instead of 1, now 9 isolates are flagged. In total, 78.3% of all isolates are marked ‘first weighted’ - 49.8% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>Instead of 2, now 6 isolates are flagged. In total, 78.7% of all isolates are marked ‘first weighted’ - 50.2% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, there’s a shortcut for this new algorithm too:</p>
<div class="sourceCode" id="cb19"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">&lt;-</span> <span class="no">data</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</pre></body></html></div>
<p>So we end up with 15,654 isolates for analysis.</p>
<p>So we end up with 15,741 isolates for analysis.</p>
<p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb20"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">&lt;-</span> <span class="no">data_1st</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(-<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="no">first</span>, <span class="no">keyab</span>))</pre></body></html></div>
@ -775,7 +775,6 @@ Longest: 1</p> @@ -775,7 +775,6 @@ Longest: 1</p>
<div class="sourceCode" id="cb21"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(<span class="no">data_1st</span>)</pre></body></html></div>
<table class="table">
<thead><tr class="header">
<th></th>
<th align="center">date</th>
<th align="center">patient_id</th>
<th align="center">hospital</th>
@ -792,93 +791,87 @@ Longest: 1</p> @@ -792,93 +791,87 @@ Longest: 1</p>
</tr></thead>
<tbody>
<tr class="odd">
<td>1</td>
<td align="center">2015-07-23</td>
<td align="center">Z5</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">2013-12-18</td>
<td align="center">P10</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>2</td>
<td align="center">2017-01-21</td>
<td align="center">D6</td>
<td align="center">2010-07-10</td>
<td align="center">K6</td>
<td align="center">Hospital C</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">B_ESCHR_COLI</td>
</