Browse Source

big website update, licence txt update

new-mo-algorithm
parent
commit
6b2d464f8c
  1. 54
      .gitlab-ci.yml
  2. 4
      DESCRIPTION
  3. 2
      NEWS.md
  4. 22
      R/ab_property.R
  5. 22
      R/abname.R
  6. 23
      R/age.R
  7. 23
      R/atc.R
  8. 22
      R/count.R
  9. 71
      R/data.R
  10. 22
      R/deprecated.R
  11. 22
      R/eucast_rules.R
  12. 29
      R/first_isolate.R
  13. 31
      R/freq.R
  14. 24
      R/g.test.R
  15. 22
      R/get_locale.R
  16. 25
      R/ggplot_rsi.R
  17. 23
      R/globals.R
  18. 62
      R/itis.R
  19. 22
      R/join_microorganisms.R
  20. 22
      R/key_antibiotics.R
  21. 22
      R/kurtosis.R
  22. 22
      R/like.R
  23. 22
      R/mdro.R
  24. 22
      R/mic.R
  25. 21
      R/misc.R
  26. 31
      R/mo.R
  27. 24
      R/mo_property.R
  28. 22
      R/p.symbol.R
  29. 22
      R/portion.R
  30. 22
      R/read.4d.R
  31. 25
      R/resistance_predict.R
  32. 22
      R/rsi.R
  33. 21
      R/rsi_calc.R
  34. 22
      R/skewness.R
  35. 26
      R/zzz.R
  36. 578
      README.md
  37. 56
      _pkgdown.yml
  38. 21
      appveyor.yml
  39. 1
      docs/CNAME
  40. 75
      docs/LICENSE-text.html
  41. 898
      docs/articles/AMR.html
  42. BIN
      docs/articles/AMR_files/figure-html/plot 1-1.png
  43. BIN
      docs/articles/AMR_files/figure-html/plot 3-1.png
  44. BIN
      docs/articles/AMR_files/figure-html/plot 4-1.png
  45. BIN
      docs/articles/AMR_files/figure-html/plot 5-1.png
  46. 245
      docs/articles/EUCAST.html
  47. 218
      docs/articles/G_test.html
  48. 218
      docs/articles/Predict.html
  49. 218
      docs/articles/ab_property.html
  50. 890
      docs/articles/freq.html
  51. 83
      docs/articles/index.html
  52. 218
      docs/articles/mo_property.html
  53. 75
      docs/authors.html
  54. 8
      docs/docsearch.json
  55. 53
      docs/extra.css
  56. 33
      docs/extra.js
  57. 97
      docs/index.html
  58. 279
      docs/news/index.html
  59. 12
      docs/pkgdown.yml
  60. 85
      docs/reference/AMR-deprecated.html
  61. 85
      docs/reference/AMR.html
  62. 92
      docs/reference/ab_property.html
  63. 111
      docs/reference/abname.html
  64. 83
      docs/reference/age.html
  65. BIN
      docs/reference/age_groups-1.png
  66. 135
      docs/reference/age_groups.html
  67. 83
      docs/reference/antibiotics.html
  68. 110
      docs/reference/as.atc.html
  69. BIN
      docs/reference/as.mic-1.png
  70. 111
      docs/reference/as.mic.html
  71. 157
      docs/reference/as.mo.html
  72. BIN
      docs/reference/as.rsi-1.png
  73. BIN
      docs/reference/as.rsi-2.png
  74. 20126
      docs/reference/as.rsi.html
  75. 102
      docs/reference/atc_property.html
  76. 167
      docs/reference/count.html
  77. 201
      docs/reference/eucast_rules.html
  78. 20370
      docs/reference/first_isolate.html
  79. BIN
      docs/reference/freq-1.png
  80. BIN
      docs/reference/freq-2.png
  81. 680
      docs/reference/freq.html
  82. 102
      docs/reference/g.test.html
  83. 83
      docs/reference/get_locale.html
  84. BIN
      docs/reference/ggplot_rsi-1.png
  85. BIN
      docs/reference/ggplot_rsi-2.png
  86. BIN
      docs/reference/ggplot_rsi-3.png
  87. BIN
      docs/reference/ggplot_rsi-4.png
  88. BIN
      docs/reference/ggplot_rsi-5.png
  89. BIN
      docs/reference/ggplot_rsi-6.png
  90. BIN
      docs/reference/ggplot_rsi-7.png
  91. 162
      docs/reference/ggplot_rsi.html
  92. 77
      docs/reference/index.html
  93. 315
      docs/reference/itis.html
  94. 12814
      docs/reference/join.html
  95. 108
      docs/reference/key_antibiotics.html
  96. 83
      docs/reference/kurtosis.html
  97. 115
      docs/reference/like.html
  98. 9906
      docs/reference/mdro.html
  99. 83
      docs/reference/microorganisms.certe.html
  100. 83
      docs/reference/microorganisms.html
  101. Some files were not shown because too many files have changed in this diff Show More

54
.gitlab-ci.yml

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
# from https://stackoverflow.com/questions/51866926
@ -23,6 +26,7 @@ @@ -23,6 +26,7 @@
stages:
- build
- test
- deploy
image: debian:buster-slim
@ -34,6 +38,11 @@ before_script: @@ -34,6 +38,11 @@ before_script:
- Rscript -e 'install.packages(c("devtools", "rlang"), repos = "https://cran.rstudio.com")'
- Rscript -e 'devtools::install_dev_deps(repos = "https://cran.rstudio.com")'
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- /usr/lib/R/library/
R 3:
stage: build
allow_failure: true
@ -45,29 +54,32 @@ R 3: @@ -45,29 +54,32 @@ R 3:
- R CMD build . --no-build-vignettes --no-manual
- PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1)
- R CMD check "${PKG_FILE_NAME}" --no-build-vignettes --no-manual --as-cran
# code coverage
- apt-get install --yes git
- Rscript -e 'cc <- covr::package_coverage(); covr::codecov(coverage = cc, token = "50ffa0aa-fee0-4f8b-a11d-8c7edc6d32ca"); cat("Code coverage:", covr::percent_coverage(cc))'
coverage: '/Code coverage: \d+\.\d+/'
artifacts:
paths:
- '*.Rcheck/*.log'
- '*.Rcheck/*.out'
# - '*.Rcheck/*.fail'
- '*.Rcheck/*.Rout'
- '*.Rcheck/*'
name: 'Rcheck log'
expire_in: '1 month'
coverage:
stage: test
allow_failure: true
when: on_success
only:
- master
script:
- apt-get install --yes git
- Rscript -e 'cc <- covr::package_coverage(); covr::codecov(coverage = cc, token = "50ffa0aa-fee0-4f8b-a11d-8c7edc6d32ca"); cat("Code coverage:", covr::percent_coverage(cc))'
coverage: '/Code coverage: \d+\.\d+/'
pages:
stage: deploy
when: always
only:
- master
script:
- Rscript -e "install.packages('pkgdown', repos = 'https://cran.rstudio.com')"
- Rscript -e "devtools::install(build = TRUE, upgrade = FALSE)"
# - R -e "pkgdown::build_favicon()"
- R -e "pkgdown::build_site(examples = FALSE, override = list(destination = 'public'))"
when: always
artifacts:
paths:
- public
only:
- master

4
DESCRIPTION

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Package: AMR
Version: 0.5.0.9008
Date: 2018-12-31
Version: 0.5.0.9009
Date: 2019-01-02
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(

2
NEWS.md

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
* **BREAKING**: removed deprecated functions, parameters and references to 'bactid'. Use `as.mo()` to identify an MO code.
* New website: https://msberends.gitlab.io/AMR (built with the great [`pkgdown`](https://pkgdown.r-lib.org/))
* Contains the complete manual of this package and all of its functions with an explanation of their parameters
* Contains a comprehensive tutorial about how to conduct antimicrobial resistance analysis
* Support for [`dplyr`](https://dplyr.tidyverse.org) version 0.8.0
* Function `mo_failures()` to review values that could not be coerced to a valid MO code, using `as.mo()`. This latter function will now only show a maximum of 25 uncoerced values.
* Function `mo_renamed()` to get a list of all returned values from `as.mo()` that have had taxonomic renaming
@ -23,6 +24,7 @@ @@ -23,6 +24,7 @@
filter(only_firsts == TRUE) %>%
select(-only_firsts)
```
* New vignettes about how to conduct AMR analysis, predict antimicrobial resistance, use the *G*-test and more. These are also available (and even easier readable) on our website: https://msberends.gitlab.io/AMR.
#### Changed
* Fixed a critical bug in `eucast_rules()` where some rules that depend on previous applied rules would not be applied adequately

22
R/ab_property.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Property of an antibiotic
@ -27,6 +30,7 @@ @@ -27,6 +30,7 @@
#' @export
#' @importFrom dplyr %>% left_join pull
#' @seealso \code{\link{antibiotics}}
#' @inheritSection AMR Read more on our website!
#' @examples
#' ab_atc("amcl") # J01CR02
#' ab_name("amcl") # Amoxicillin and beta-lactamase inhibitor

22
R/abname.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Name of an antibiotic
@ -28,6 +31,7 @@ @@ -28,6 +31,7 @@
#' @source \code{\link{antibiotics}}
#' @export
#' @importFrom dplyr %>% pull
#' @inheritSection AMR Read more on our website!
#' @examples
#' abname("AMCL")
#' # "Amoxicillin and beta-lactamase inhibitor"

23
R/age.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Age in years of individuals
@ -24,6 +27,7 @@ @@ -24,6 +27,7 @@
#' @return Integer (no decimals)
#' @seealso \code{\link{age_groups}} to splits age into groups
#' @importFrom dplyr if_else
#' @inheritSection AMR Read more on our website!
#' @export
age <- function(x, reference = Sys.Date()) {
if (length(x) != length(reference)) {
@ -70,6 +74,7 @@ age <- function(x, reference = Sys.Date()) { @@ -70,6 +74,7 @@ age <- function(x, reference = Sys.Date()) {
#' @return Ordered \code{\link{factor}}
#' @seealso \code{\link{age}} to determine ages based on one or more reference dates
#' @export
#' @inheritSection AMR Read more on our website!
#' @examples
#' ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21)
#'

23
R/atc.R

@ -2,21 +2,23 @@ @@ -2,21 +2,23 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Transform to ATC code
#'
#' Use this function to determine the ATC code of one or more antibiotics. The data set \code{\link{antibiotics}} will be searched for abbreviations, official names and trade names.
@ -32,6 +34,7 @@ @@ -32,6 +34,7 @@
#' Source: \url{https://www.whocc.no/atc/structure_and_principles/}
#' @return Character (vector) with class \code{"act"}. Unknown values will return \code{NA}.
#' @seealso \code{\link{antibiotics}} for the dataframe that is being used to determine ATCs.
#' @inheritSection AMR Read more on our website!
#' @examples
#' # These examples all return "J01FA01", the ATC code of Erythromycin:
#' as.atc("J01FA01")

22
R/count.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Count isolates
@ -35,6 +38,7 @@ @@ -35,6 +38,7 @@
#' @rdname count
#' @name count
#' @export
#' @inheritSection AMR Read more on our website!
#' @examples
#' # septic_patients is a data set available in the AMR package. It is true, genuine data.
#' ?septic_patients

71
R/data.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Data set with 423 antibiotics
@ -41,6 +44,7 @@ @@ -41,6 +44,7 @@
#' \item{\code{useful_grampositive}}{\code{FALSE} if not useful according to EUCAST, \code{NA} otherwise (see Source)}
#' }
#' @source - World Health Organization: \url{https://www.whocc.no/atc_ddd_index/} \cr - EUCAST - Expert rules intrinsic exceptional V3.1 \cr - MOLIS (LIS of Certe): \url{https://www.certe.nl} \cr - GLIMS (LIS of UMCG): \url{https://www.umcg.nl}
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{microorganisms}}
# use this later to further fill AMR::antibiotics
# drug <- "Ciprofloxacin"
@ -123,7 +127,7 @@ @@ -123,7 +127,7 @@
#' Data set with taxonomic data from ITIS
#'
#' A data set containing the complete microbial taxonomy of the kingdoms Bacteria, Fungi and Protozoa. MO codes can be looked up using \code{\link{as.mo}}.
#' @inheritSection as.mo ITIS
#' @inheritSection itis ITIS
#' @format A \code{\link{data.frame}} with 18,833 observations and 15 variables:
#' \describe{
#' \item{\code{mo}}{ID of microorganism}
@ -143,6 +147,7 @@ @@ -143,6 +147,7 @@
#' \item{\code{ref}}{Author(s) and year of concerning publication as found in ITIS, see Source}
#' }
#' @source [3] Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms.umcg}}
"microorganisms"
@ -158,6 +163,7 @@ @@ -158,6 +163,7 @@
#' \item{\code{ref}}{Author(s) and year of concerning publication as found in ITIS, see Source}
#' }
#' @source [3] Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms}}
"microorganisms.old"
@ -169,6 +175,7 @@ @@ -169,6 +175,7 @@
#' \item{\code{umcg}}{Code of microorganism according to UMCG MMB}
#' \item{\code{certe}}{Code of microorganism according to Certe MMB}
#' }
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{as.mo}} \code{\link{microorganisms.certe}} \code{\link{microorganisms}}
"microorganisms.umcg"
@ -180,12 +187,13 @@ @@ -180,12 +187,13 @@
#' \item{\code{certe}}{Code of microorganism according to Certe MMB}
#' \item{\code{mo}}{Code of microorganism in \code{\link{microorganisms}}}
#' }
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{as.mo}} \code{\link{microorganisms}}
"microorganisms.certe"
#' Data set with 2000 blood culture isolates of septic patients
#'
#' An anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found in septic patients in 4 different hospitals in the Netherlands, between 2001 and 2017. It is true, genuine data. This \code{data.frame} can be used to practice AMR analysis. For examples, press F1.
#' An anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found in septic patients in 4 different hospitals in the Netherlands, between 2001 and 2017. It is true, genuine data. This \code{data.frame} can be used to practice AMR analysis. For examples, please read \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{the tutorial on our website}.
#' @format A \code{\link{data.frame}} with 2,000 observations and 49 variables:
#' \describe{
#' \item{\code{date}}{date of receipt at the laboratory}
@ -199,45 +207,7 @@ @@ -199,45 +207,7 @@
#' \item{\code{mo}}{ID of microorganism created with \code{\link{as.mo}}, see also \code{\link{microorganisms}}}
#' \item{\code{peni:rifa}}{40 different antibiotics with class \code{rsi} (see \code{\link{as.rsi}}); these column names occur in \code{\link{antibiotics}} data set and can be translated with \code{\link{abname}}}
#' }
#' @examples
#' # ----------- #
#' # PREPARATION #
#' # ----------- #
#'
#' # Save this example data set to an object, so we can edit it:
#' my_data <- septic_patients
#'
#' # load the dplyr package to make data science A LOT easier
#' library(dplyr)
#'
#' # Add first isolates to our data set:
#' my_data <- my_data %>%
#' mutate(first_isolates = first_isolate(my_data, "date", "patient_id", "mo"))
#'
#' # -------- #
#' # ANALYSIS #
#' # -------- #
#'
#' # 1. Get the amoxicillin resistance percentages (p)
#' # and numbers (n) of E. coli, divided by hospital:
#'
#' my_data %>%
#' filter(mo == guess_mo("E. coli"),
#' first_isolates == TRUE) %>%
#' group_by(hospital_id) %>%
#' summarise(n = n_rsi(amox),
#' p = portion_IR(amox))
#'
#'
#' # 2. Get the amoxicillin/clavulanic acid resistance
#' # percentages of E. coli, trend over the years:
#'
#' my_data %>%
#' filter(mo == guess_mo("E. coli"),
#' first_isolates == TRUE) %>%
#' group_by(year = format(date, "%Y")) %>%
#' summarise(n = n_rsi(amcl),
#' p = portion_IR(amcl, minimum = 20))
#' @inheritSection AMR Read more on our website!
"septic_patients"
#' Supplementary Data
@ -245,6 +215,7 @@ @@ -245,6 +215,7 @@
#' These \code{\link{data.table}s} are transformed from the \code{\link{microorganisms}} and \code{\link{microorganisms}} data sets to improve speed of \code{\link{as.mo}}. They are meant for internal use only, and are only mentioned here for reference.
#' @rdname supplementary_data
#' @name supplementary_data
#' @inheritSection AMR Read more on our website!
# # Renew data:
# microorganismsDT <- data.table::as.data.table(AMR::microorganisms)
# # sort on (1) bacteria, (2) fungi, (3) protozoa and then human pathogenic prevalence and then TSN:

22
R/deprecated.R

@ -2,23 +2,27 @@ @@ -2,23 +2,27 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Deprecated functions
#'
#' These functions are \link{Deprecated}. They will be removed in a future release. Using the functions will give a warning with the name of the function it has been replaced by.
#' @inheritSection AMR Read more on our website!
#' @export
#' @keywords internal
#' @name AMR-deprecated

22
R/eucast_rules.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' EUCAST rules
@ -115,6 +118,7 @@ @@ -115,6 +118,7 @@
#' \url{http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_8.1_Breakpoint_Tables.xlsx}
#' }
#' }
#' @inheritSection AMR Read more on our website!
#' @examples
#' a <- eucast_rules(septic_patients)
#'

29
R/first_isolate.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Determine first (weighted) isolates
@ -71,6 +74,7 @@ @@ -71,6 +74,7 @@
#' @importFrom crayon blue bold silver
#' @return Logical vector
#' @source Methodology of this function is based on: \strong{M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition}, 2014, \emph{Clinical and Laboratory Standards Institute (CLSI)}. \url{https://clsi.org/standards/products/microbiology/documents/m39/}.
#' @inheritSection AMR Read more on our website!
#' @examples
#' # septic_patients is a dataset available in the AMR package. It is true, genuine data.
#' ?septic_patients
@ -419,12 +423,7 @@ first_isolate <- function(tbl, @@ -419,12 +423,7 @@ first_isolate <- function(tbl,
& genus == lag(genus)
& species == lag(species),
FALSE,
TRUE)) %>% #,
# days_diff = 0) %>%
# mutate(days_diff = if_else(other_pat_or_mo == FALSE,
# as.integer((date_lab - lag(date_lab)) + lag(days_diff)),
# as.integer(0))) %>%
# mutate(r = days_diff) %>%
TRUE)) %>%
group_by_at(vars(patient_id,
genus,
species)) %>%

31
R/freq.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Frequency table
@ -73,6 +76,7 @@ @@ -73,6 +76,7 @@
#' @name freq
#' @return A \code{data.frame} (with an additional class \code{"frequency_tbl"}) with five columns: \code{item}, \code{count}, \code{percent}, \code{cum_count} and \code{cum_percent}.
#' @export
#' @inheritSection AMR Read more on our website!
#' @examples
#' library(dplyr)
#'
@ -812,7 +816,7 @@ print.frequency_tbl <- function(x, @@ -812,7 +816,7 @@ print.frequency_tbl <- function(x,
if (opt$tbl_format == "pandoc") {
title <- bold(title)
} else if (opt$tbl_format == "markdown") {
title <- paste0("\n**", title, "**")
title <- paste0("\n**", title, "** ") # two space for newline
}
if (opt$header == TRUE) {
@ -825,7 +829,7 @@ print.frequency_tbl <- function(x, @@ -825,7 +829,7 @@ print.frequency_tbl <- function(x,
}
} else if (opt$tbl_format == "markdown") {
# do print title as caption in markdown
cat("\n", title, " ", sep = "") # two trailing spaces for markdown
cat("\n", title, sep = "") # two trailing spaces for markdown
}
if (NROW(x) == 0) {
@ -838,6 +842,11 @@ print.frequency_tbl <- function(x, @@ -838,6 +842,11 @@ print.frequency_tbl <- function(x,
if (is.null(opt$na)) {
opt$na <- "<NA>"
}
if (opt$tbl_format == "markdown") {
# no HTML tags
opt$na <- gsub("<", "(", opt$na, fixed = TRUE)
opt$na <- gsub(">", ")", opt$na, fixed = TRUE)
}
options(knitr.kable.NA = opt$na)
x.rows <- nrow(x)

24
R/g.test.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' \emph{G}-test for Count Data
@ -69,6 +72,7 @@ @@ -69,6 +72,7 @@
#' }
#' @export
#' @importFrom stats pchisq complete.cases
#' @inheritSection AMR Read more on our website!
#' @examples
#' # = EXAMPLE 1 =
#' # Shivrain et al. (2006) crossed clearfield rice (which are resistant
@ -79,7 +83,7 @@ @@ -79,7 +83,7 @@
#' # by a single gene with two co-dominant alleles, you would expect a 1:2:1
#' # ratio.
#'
#' x <- c(772, 1611, 737)#'
#' x <- c(772, 1611, 737)
#' G <- g.test(x, p = c(1, 2, 1) / 4)
#' # G$p.value = 0.12574.
#'

22
R/get_locale.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Get language for AMR
@ -22,6 +25,7 @@ @@ -22,6 +25,7 @@
#' @details The system language can be overwritten with \code{\link{getOption}("AMR_locale")}.
#' @section Supported languages:
#' Supported languages are \code{"en"} (English), \code{"de"} (German), \code{"nl"} (Dutch), \code{"es"} (Spanish), \code{"it"} (Italian), \code{"fr"} (French), and \code{"pt"} (Portuguese).
#' @inheritSection AMR Read more on our website!
#' @export
get_locale <- function() {
if (!is.null(getOption("AMR_locale"))) {

25
R/ggplot_rsi.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' AMR bar plots with \code{ggplot}
@ -52,6 +55,7 @@ @@ -52,6 +55,7 @@
#' @rdname ggplot_rsi
#' @importFrom utils installed.packages
#' @export
#' @inheritSection AMR Read more on our website!
#' @examples
#' library(dplyr)
#' library(ggplot2)
@ -298,6 +302,9 @@ facet_rsi <- function(facet = c("Interpretation", "Antibiotic"), nrow = NULL) { @@ -298,6 +302,9 @@ facet_rsi <- function(facet = c("Interpretation", "Antibiotic"), nrow = NULL) {
#' @rdname ggplot_rsi
#' @export
scale_y_percent <- function(breaks = seq(0, 1, 0.1), limits = NULL) {
if (all(breaks[breaks != 0] > 1)) {
breaks <- breaks / 100
}
ggplot2::scale_y_continuous(breaks = breaks,
labels = percent(breaks),
limits = limits)

23
R/globals.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
globalVariables(c(".",
@ -30,7 +33,6 @@ globalVariables(c(".", @@ -30,7 +33,6 @@ globalVariables(c(".",
"cum_count",
"cum_percent",
"date_lab",
"days_diff",
"diff.percent",
"fctlvl",
"first_isolate_row_index",
@ -58,6 +60,7 @@ globalVariables(c(".", @@ -58,6 +60,7 @@ globalVariables(c(".",
"microorganisms.umcg",
"mo",
"mo.old",
"more_than_episode_ago",
"n",
"name",
"observations",

62
R/itis.R

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' ITIS: Integrated Taxonomic Information System
#'
#' All taxonomic names of all microorganisms are included in this package, using the authoritative Integrated Taxonomic Information System (ITIS).
#' @section ITIS:
#' \if{html}{\figure{itis_logo.jpg}{options: height=60px style=margin-bottom:5px} \cr}
#' This package contains the \strong{complete microbial taxonomic data} (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, \url{https://www.itis.gov}).
#'
#' All (sub)species from \strong{the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
#'
#' ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
#' @inheritSection AMR Read more on our website!
#' @name itis
#' @rdname itis
#' @examples
#' # Get a note when a species was renamed
#' mo_shortname("Chlamydia psittaci")
#' # Note: 'Chlamydia psittaci' (Page, 1968) was renamed 'Chlamydophila psittaci' (Everett et al., 1999)
#' # [1] "C. psittaci"
#'
#' # Get any property from the entire taxonomic tree for all included species
#' mo_class("E. coli")
#' # [1] "Gammaproteobacteria"
#'
#' mo_family("E. coli")
#' # [1] "Enterobacteriaceae"
#'
#' mo_subkingdom("E. coli")
#' # [1] "Negibacteria"
#'
#' mo_gramstain("E. coli") # based on subkingdom
#' # [1] "Gram negative"
#'
#' mo_ref("E. coli")
#' # [1] "Castellani and Chalmers, 1919"
#'
#' # Do not get mistaken - the package only includes microorganisms
#' mo_phylum("C. elegans")
#' # [1] "Cyanobacteria" # Bacteria?!
#' mo_fullname("C. elegans")
#' # [1] "Chroococcus limneticus elegans" # Because a microorganism was found
NULL

22
R/join_microorganisms.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Join a table with \code{microorganisms}
@ -27,6 +30,7 @@ @@ -27,6 +30,7 @@
#' @param suffix if there are non-joined duplicate variables in \code{x} and \code{y}, these suffixes will be added to the output to disambiguate them. Should be a character vector of length 2.
#' @param ... other parameters to pass on to \code{dplyr::\link[dplyr]{join}}.
#' @details \strong{Note:} As opposed to the \code{\link[dplyr]{join}} functions of \code{dplyr}, characters vectors are supported and at default existing columns will get a suffix \code{"2"} and the newly joined columns will not get a suffix. See \code{\link[dplyr]{join}} for more information.
#' @inheritSection AMR Read more on our website!
#' @export
#' @examples
#' left_join_microorganisms(as.mo("K. pneumoniae"))

22
R/key_antibiotics.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Key antibiotics for first \emph{weighted} isolates
@ -43,6 +46,7 @@ @@ -43,6 +46,7 @@
#' @importFrom dplyr %>% mutate if_else
#' @importFrom crayon blue bold
#' @seealso \code{\link{first_isolate}}
#' @inheritSection AMR Read more on our website!
#' @examples
#' # septic_patients is a dataset available in the AMR package
#' ?septic_patients

22
R/kurtosis.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Kurtosis of the sample
@ -25,6 +28,7 @@ @@ -25,6 +28,7 @@
#' @exportMethod kurtosis
#' @seealso \code{\link{skewness}}
#' @rdname kurtosis
#' @inheritSection AMR Read more on our website!
#' @export
kurtosis <- function(x, na.rm = FALSE) {
UseMethod("kurtosis")

22
R/like.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Pattern Matching
@ -27,6 +30,7 @@ @@ -27,6 +30,7 @@
#' @details Using RStudio? This function can also be inserted from the Addins menu and can have its own Keyboard Shortcut like Ctrl+Shift+L or Cmd+Shift+L (see Tools > Modify Keyboard Shortcuts...).
#' @source Idea from the \href{https://github.com/Rdatatable/data.table/blob/master/R/like.R}{\code{like} function from the \code{data.table} package}, but made it case insensitive at default and let it support multiple patterns.
#' @seealso \code{\link[base]{grep}}
#' @inheritSection AMR Read more on our website!
#' @examples
#' # simple test
#' a <- "This is a test"

22
R/mdro.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Determine multidrug-resistant organisms (MDRO)
@ -32,6 +35,7 @@ @@ -32,6 +35,7 @@
#' @importFrom dplyr %>%
#' @importFrom crayon red blue bold
#' @export
#' @inheritSection AMR Read more on our website!
#' @examples
#' library(dplyr)
#'

22
R/mic.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Class 'mic'
@ -27,6 +30,7 @@ @@ -27,6 +30,7 @@
#' @export
#' @importFrom dplyr %>%
#' @seealso \code{\link{as.rsi}}
#' @inheritSection AMR Read more on our website!
#' @examples
#' mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
#' is.mic(mic_data)

21
R/misc.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
# No export, no Rd

31
R/mo.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# AUTHORS #
# Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# This package is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License version 2.0, #
# as published by the Free Software Foundation. #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License version 2.0 for more details. #
# 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. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
#' Transform to microorganism ID
@ -74,14 +77,7 @@ @@ -74,14 +77,7 @@
#' }
#'
#' \code{guess_mo} is an alias of \code{as.mo}.
#' @section ITIS:
#' \if{html}{\figure{itis_logo.jpg}{options: height=60px style=margin-bottom:5px} \cr}
#' This package contains the \strong{complete microbial taxonomic data} (with all nine taxonomic ranks - from kingdom to subspecies) from the publicly available Integrated Taxonomic Information System (ITIS, \url{https://www.itis.gov}).
#'
#' All (sub)species from \strong{the taxonomic kingdoms Bacteria, Fungi and Protozoa are included in this package}, as well as all previously accepted names known to ITIS. Furthermore, the responsible authors and year of publication are available. This allows users to use authoritative taxonomic information for their data analysis on any microorganism, not only human pathogens. It also helps to quickly determine the Gram stain of bacteria, since all bacteria are classified into subkingdom Negibacteria or Posibacteria.
#'
#' ITIS is a partnership of U.S., Canadian, and Mexican agencies and taxonomic specialists [3].
#'
#' @inheritSection itis ITIS
# (source as a section, so it can be inherited by other man pages)
#' @section Source:
#' [1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
@ -93,6 +89,7 @@ @@ -93,6 +89,7 @@
#' @return Character (vector) with class \code{"mo"}. Unknown values will return \code{NA}.
#' @seealso \code{\link{microorganisms}} for the \code{data.frame} with ITIS content that is being used to determine ID's. \cr
#' The \code{\link{mo_property}} functions (like \code{\link{mo_genus}}, \code{\link{mo_gramstain}}) to get properties based on the returned code.
#' @inheritSection AMR Read more on our website!
#' @examples
#' # These examples all return "B_STPHY_AUR", the ID of S. aureus:
#' as.mo("stau")

24
R/mo_property.R

@ -2,18 +2,21 @@ @@ -2,18 +2,21 @@
# TITLE #