Browse Source

(v1.1.0.9007) lose dependencies

new-mo-algorithm
parent
commit
f68d71a5e0
  1. 2
      DESCRIPTION
  2. 2
      NEWS.md
  3. 2
      R/availability.R
  4. 2
      R/count.R
  5. 2
      R/disk.R
  6. 3
      R/eucast_rules.R
  7. 2
      R/ggplot_rsi.R
  8. 3
      R/key_antibiotics.R
  9. 2
      R/like.R
  10. 5
      R/mdro.R
  11. 3
      R/mo_source.R
  12. 7
      R/proportion.R
  13. 9
      R/resistance_predict.R
  14. 4
      R/rsi.R
  15. 2
      appveyor.yml
  16. 2
      docs/404.html
  17. 2
      docs/LICENSE-text.html
  18. 2
      docs/articles/index.html
  19. 2
      docs/authors.html
  20. 2
      docs/index.html
  21. 2
      docs/pkgdown.yml
  22. 10
      docs/reference/as.disk.html
  23. 10
      docs/reference/as.rsi.html
  24. 8
      docs/reference/atc_online.html
  25. 8
      docs/reference/availability.html
  26. 4
      docs/reference/count.html
  27. 79
      docs/reference/ggplot_rsi.html
  28. 2
      docs/reference/index.html
  29. 5
      docs/reference/key_antibiotics.html
  30. 6
      docs/reference/like.html
  31. 6
      docs/reference/mdro.html
  32. 7
      docs/reference/proportion.html
  33. 11
      docs/reference/resistance_predict.html
  34. 2
      man/as.disk.Rd
  35. 4
      man/as.rsi.Rd
  36. 2
      man/atc_online.Rd
  37. 2
      man/availability.Rd
  38. 2
      man/count.Rd
  39. 77
      man/ggplot_rsi.Rd
  40. 3
      man/key_antibiotics.Rd
  41. 2
      man/like.Rd
  42. 2
      man/mdro.Rd
  43. 7
      man/proportion.Rd
  44. 9
      man/resistance_predict.Rd

2
DESCRIPTION

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Package: AMR
Version: 1.1.0.9006
Version: 1.1.0.9007
Date: 2020-05-16
Title: Antimicrobial Resistance Analysis
Authors@R: c(

2
NEWS.md

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# AMR 1.1.0.9006
# AMR 1.1.0.9007
## <small>Last updated: 16-May-2020</small>
### Breaking

2
R/availability.R

@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
#' @examples
#' availability(example_isolates)
#'
#' \dontrun{
#' library(dplyr)
#' example_isolates %>% availability()
#'
@ -43,6 +44,7 @@ @@ -43,6 +44,7 @@
#' filter(mo == as.mo("E. coli")) %>%
#' select_if(is.rsi) %>%
#' availability()
#' }
availability <- function(tbl, width = NULL) {
x <- base::sapply(tbl, function(x) {
1 - base::sum(base::is.na(x)) / base::length(x)

2
R/count.R

@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
#' susceptibility(example_isolates$AMX) * n_rsi(example_isolates$AMX)
#'
#'
#' if (!require("dplyr")) {
#' if (require("dplyr")) {
#' example_isolates %>%
#' group_by(hospital_id) %>%
#' summarise(R = count_R(CIP),

2
R/disk.R

@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
#' @seealso [as.rsi()]
#' @inheritSection AMR Read more on our website!
#' @examples
#' \dontrun{
#' # transform existing disk zones to the `disk` class
#' library(dplyr)
#' df <- data.frame(microorganism = "E. coli",
@ -50,6 +51,7 @@ @@ -50,6 +51,7 @@
#' guideline = "EUCAST")
#'
#' as.rsi(df)
#' }
as.disk <- function(x, na.rm = FALSE) {
if (is.disk(x)) {
x

3
R/eucast_rules.R

@ -206,7 +206,8 @@ eucast_rules <- function(x, @@ -206,7 +206,8 @@ eucast_rules <- function(x,
"\n\nThis may overwrite your existing data if you use e.g.:",
"\ndata <- eucast_rules(data, verbose = TRUE)\n\nDo you want to continue?")
if ("rstudioapi" %in% rownames(utils::installed.packages())) {
q_continue <- rstudioapi::showQuestion("Using verbose = TRUE with eucast_rules()", txt)
showQuestion <- get("showQuestion", envir = asNamespace("rstudioapi"))
q_continue <- showQuestion("Using verbose = TRUE with eucast_rules()", txt)
} else {
q_continue <- utils::menu(choices = c("OK", "Cancel"), graphics = FALSE, title = txt)
}

2
R/ggplot_rsi.R

@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
#' @export
#' @inheritSection AMR Read more on our website!
#' @examples
#' if (!require("ggplot2") & !require("dplyr")) {
#' if (require("ggplot2") & require("dplyr")) {
#'
#' # get antimicrobial results for drugs against a UTI:
#' ggplot(example_isolates %>% select(AMX, NIT, FOS, TMP, CIP)) +

3
R/key_antibiotics.R

@ -73,6 +73,7 @@ @@ -73,6 +73,7 @@
#' # `example_isolates` is a dataset available in the AMR package.
#' # See ?example_isolates.
#'
#' \dontrun{
#' library(dplyr)
#' # set key antibiotics to a new variable
#' my_patients <- example_isolates %>%
@ -87,7 +88,7 @@ @@ -87,7 +88,7 @@
#' # Check the difference, in this data set it results in 7% more isolates:
#' sum(my_patients$first_regular, na.rm = TRUE)
#' sum(my_patients$first_weighted, na.rm = TRUE)
#'
#' }
#'
#' # output of the `key_antibiotics` function could be like this:
#' strainA <- "SSSRR.S.R..S"

2
R/like.R

@ -57,10 +57,12 @@ @@ -57,10 +57,12 @@
#' #> TRUE TRUE TRUE
#'
#' # get isolates whose name start with 'Ent' or 'ent'
#' \dontrun{
#' library(dplyr)
#' example_isolates %>%
#' filter(mo_name(mo) %like% "^ent") %>%
#' freq(mo)
#' }
like <- function(x, pattern, ignore.case = TRUE) {
# set to fixed if no regex found
fixed <- all(!grepl("[$.^*?+}{|)(]", pattern))

5
R/mdro.R

@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
#' @source
#' Please see *Details* for the list of publications used for this function.
#' @examples
#' \donttest{
#' \dontrun{
#' library(dplyr)
#'
#' example_isolates %>%
@ -94,7 +94,8 @@ mdro <- function(x, @@ -94,7 +94,8 @@ mdro <- function(x,
"\n\nThis may overwrite your existing data if you use e.g.:",
"\ndata <- mdro(data, verbose = TRUE)\n\nDo you want to continue?")
if ("rstudioapi" %in% rownames(utils::installed.packages())) {
q_continue <- rstudioapi::showQuestion("Using verbose = TRUE with mdro()", txt)
showQuestion <- get("showQuestion", envir = asNamespace("rstudioapi"))
q_continue <- showQuestion("Using verbose = TRUE with mdro()", txt)
} else {
q_continue <- utils::menu(choices = c("OK", "Cancel"), graphics = FALSE, title = txt)
}

3
R/mo_source.R

@ -126,7 +126,8 @@ set_mo_source <- function(path) { @@ -126,7 +126,8 @@ set_mo_source <- function(path) {
} else if (path %like% "[.]xlsx?$") {
# is Excel file (old or new)
stopifnot_installed_package("readxl")
df <- readxl::read_excel(path)
read_excel <- get("read_excel", envir = asNamespace("readxl"))
df <- read_excel(path)
} else if (path %like% "[.]tsv$") {
df <- utils::read.table(header = TRUE, sep = "\t", stringsAsFactors = FALSE)

7
R/proportion.R

@ -99,8 +99,7 @@ @@ -99,8 +99,7 @@
#' proportion_IR(example_isolates$AMX)
#' proportion_R(example_isolates$AMX)
#'
#' if (!require("dplyr")) {
#' library(dplyr)
#' if (require("dplyr")) {
#' example_isolates %>%
#' group_by(hospital_id) %>%
#' summarise(r = resistance(CIP),
@ -157,7 +156,9 @@ @@ -157,7 +156,9 @@
#' select(hospital_id, AMX, CIP) %>%
#' group_by(hospital_id) %>%
#' proportion_df(translate = FALSE)
#'
#' }
#'
#' \dontrun{
#' # calculate current empiric combination therapy of Helicobacter gastritis:
#' my_table %>%
#' filter(first_isolate == TRUE,

9
R/resistance_predict.R

@ -66,11 +66,12 @@ @@ -66,11 +66,12 @@
#' year_min = 2010,
#' model = "binomial")
#' plot(x)
#' ggplot_rsi_predict(x)
#' if (require("ggplot2")) {
#' ggplot_rsi_predict(x)
#' }
#'
#' # using dplyr:
#' if (!require("dplyr")) {
#' library(dplyr)
#' if (require("dplyr")) {
#' x <- example_isolates %>%
#' filter_first_isolate() %>%
#' filter(mo_genus(mo) == "Staphylococcus") %>%
@ -83,7 +84,7 @@ @@ -83,7 +84,7 @@
#' }
#'
#' # create nice plots with ggplot2 yourself
#' if (!require(ggplot2) & !require("dplyr")) {
#' if (require(ggplot2) & require("dplyr")) {
#'
#' data <- example_isolates %>%
#' filter(mo == as.mo("E. coli")) %>%

4
R/rsi.R

@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
#' NIT = as.mic(32))
#' as.rsi(df)
#'
#' \donttest{
#' \dontrun{
#'
#' # the dplyr way
#' library(dplyr)
@ -117,6 +117,7 @@ @@ -117,6 +117,7 @@
#' plot(rsi_data) # for percentages
#' barplot(rsi_data) # for frequencies
#'
#' \dontrun{
#' library(dplyr)
#' example_isolates %>%
#' mutate_at(vars(PEN:RIF), as.rsi)
@ -132,6 +133,7 @@ @@ -132,6 +133,7 @@
#' # default threshold of `is.rsi.eligible` is 5%.
#' is.rsi.eligible(WHONET$`First name`) # fails, >80% is invalid
#' is.rsi.eligible(WHONET$`First name`, threshold = 0.99) # succeeds
#' }
as.rsi <- function(x, ...) {
UseMethod("as.rsi")
}

2
appveyor.yml

@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
init:
ps: |
$ErrorActionPreference = "Stop"
Invoke-WebRequest https://gitlab.com/msberends/AMR/raw/master/tests/appveyor/appveyor_tool.ps1 -OutFile "..\appveyor-tool.ps1"
Invoke-WebRequest https://gitlab.com/msberends/AMR/raw/premaster/tests/appveyor/appveyor_tool.ps1 -OutFile "..\appveyor-tool.ps1"
Import-Module '..\appveyor-tool.ps1'
install:

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.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</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.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>

2
docs/articles/index.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.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>

2
docs/authors.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.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>

2
docs/index.html

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

2
docs/pkgdown.yml

@ -10,7 +10,7 @@ articles: @@ -10,7 +10,7 @@ articles:
WHONET: WHONET.html
benchmarks: benchmarks.html
resistance_predict: resistance_predict.html
last_built: 2020-05-16T18:05Z
last_built: 2020-05-16T19:39Z
urls:
reference: https://msberends.gitlab.io/AMR/reference
article: https://msberends.gitlab.io/AMR/articles

10
docs/reference/as.disk.html

@ -82,7 +82,7 @@ @@ -82,7 +82,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</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -275,7 +275,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -275,7 +275,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<div class='dont-index'><p><code><a href='as.rsi.html'>as.rsi()</a></code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='co'># transform existing disk zones to the `disk` class</span>
<pre class="examples"><span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='co'># transform existing disk zones to the `disk` class</span>
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></span>(<span class='kw'>microorganism</span> <span class='kw'>=</span> <span class='st'>"E. coli"</span>,
<span class='kw'>AMP</span> <span class='kw'>=</span> <span class='fl'>20</span>,
@ -291,7 +292,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -291,7 +292,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='kw'>ab</span> <span class='kw'>=</span> <span class='st'>"ampicillin"</span>, <span class='co'># and `ab` with as.ab()</span>
<span class='kw'>guideline</span> <span class='kw'>=</span> <span class='st'>"EUCAST"</span>)
<span class='fu'><a href='as.rsi.html'>as.rsi</a></span>(<span class='no'>df</span>)</pre>
<span class='fu'><a href='as.rsi.html'>as.rsi</a></span>(<span class='no'>df</span>)
}</pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top">
@ -307,7 +309,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -307,7 +309,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
</div>
</footer>

10
docs/reference/as.rsi.html

@ -82,7 +82,7 @@ @@ -82,7 +82,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.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -353,7 +353,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -353,7 +353,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='kw'>NIT</span> <span class='kw'>=</span> <span class='fu'><a href='as.mic.html'>as.mic</a></span>(<span class='fl'>32</span>))
<span class='fu'>as.rsi</span>(<span class='no'>df</span>)
<span class='co'># \donttest{</span>
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='co'># the dplyr way</span>
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
@ -376,7 +376,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -376,7 +376,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='no'>df</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='no'>AMP</span>:<span class='no'>NIT</span>), <span class='no'>as.rsi</span>, <span class='kw'>mo</span> <span class='kw'>=</span> <span class='st'>"E. coli"</span>, <span class='kw'>uti</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
<span class='co'># }</span>
}
<span class='co'># for single values</span>
<span class='fu'>as.rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='fu'><a href='as.mic.html'>as.mic</a></span>(<span class='fl'>2</span>),
@ -400,6 +400,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -400,6 +400,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='fu'><a href='https://rdrr.io/r/base/plot.html'>plot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for percentages</span>
<span class='fu'><a href='https://rdrr.io/r/graphics/barplot.html'>barplot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for frequencies</span>
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='no'>PEN</span>:<span class='no'>RIF</span>), <span class='no'>as.rsi</span>)
@ -414,7 +415,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -414,7 +415,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='co'># default threshold of `is.rsi.eligible` is 5%.</span>
<span class='fu'>is.rsi.eligible</span>(<span class='no'>WHONET</span>$<span class='no'>`First name`</span>) <span class='co'># fails, &gt;80% is invalid</span>
<span class='fu'>is.rsi.eligible</span>(<span class='no'>WHONET</span>$<span class='no'>`First name`</span>, <span class='kw'>threshold</span> <span class='kw'>=</span> <span class='fl'>0.99</span>) <span class='co'># succeeds</span></pre>
<span class='fu'>is.rsi.eligible</span>(<span class='no'>WHONET</span>$<span class='no'>`First name`</span>, <span class='kw'>threshold</span> <span class='kw'>=</span> <span class='fl'>0.99</span>) <span class='co'># succeeds</span>
}</pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top">

8
docs/reference/atc_online.html

@ -83,7 +83,7 @@ This function requires an internet connection." /> @@ -83,7 +83,7 @@ This function requires an internet connection." />
</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</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -315,7 +315,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>questioni @@ -315,7 +315,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>questioni
<p>On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitlab.io/AMR</a> you can find <a href='https://msberends.gitlab.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.gitlab.io/AMR/reference'>complete documentation of all functions</a> (which reads a lot easier than here in R) and <a href='https://msberends.gitlab.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='co'># \donttest{</span>
<pre class="examples"><span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='co'># oral DDD (Defined Daily Dose) of amoxicillin</span>
<span class='fu'>atc_online_property</span>(<span class='st'>"J01CA04"</span>, <span class='st'>"DDD"</span>, <span class='st'>"O"</span>)
<span class='co'># parenteral DDD (Defined Daily Dose) of amoxicillin</span>
@ -326,7 +326,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>questioni @@ -326,7 +326,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>questioni
<span class='co'># [2] "ANTIBACTERIALS FOR SYSTEMIC USE"</span>
<span class='co'># [3] "BETA-LACTAM ANTIBACTERIALS, PENICILLINS"</span>
<span class='co'># [4] "Penicillins with extended spectrum"</span>
<span class='co'># }</span></pre>
}</pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top">
@ -342,7 +342,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>questioni @@ -342,7 +342,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>questioni
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
</div>
</footer>

8
docs/reference/availability.html

@ -82,7 +82,7 @@ @@ -82,7 +82,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</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -272,6 +272,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -272,6 +272,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='fu'>availability</span>(<span class='no'>example_isolates</span>)
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span> <span class='fu'>availability</span>()
@ -282,7 +283,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -282,7 +283,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select_all.html'>select_if</a></span>(<span class='no'>is.rsi</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>availability</span>()</pre>
<span class='fu'>availability</span>()
}</pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top">
@ -298,7 +300,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -298,7 +300,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.0.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
</div>
</footer>

4
docs/reference/count.html

@ -83,7 +83,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible( @@ -83,7 +83,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
</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.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -392,7 +392,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when @@ -392,7 +392,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
<span class='fu'><a href='proportion.html'>susceptibility</a></span>(<span class='no'>example_isolates</span>$<span class='no'>AMX</span>) * <span class='fu'>n_rsi</span>(<span class='no'>example_isolates</span>$<span class='no'>AMX</span>)
<span class='kw'>if</span> (!<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
<span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>count_R</span>(<span class='no'>CIP</span>),

79
docs/reference/ggplot_rsi.html

@ -82,7 +82,7 @@ @@ -82,7 +82,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.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -412,44 +412,45 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing< @@ -412,44 +412,45 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
<p>On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitlab.io/AMR</a> you can find <a href='https://msberends.gitlab.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.gitlab.io/AMR/reference'>complete documentation of all functions</a> (which reads a lot easier than here in R) and <a href='https://msberends.gitlab.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>ggplot2</span>)
<span class='co'># get antimicrobial results for drugs against a UTI:</span>
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>)) +
<span class='fu'>geom_rsi</span>()
<span class='co'># prettify the plot using some additional functions:</span>
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>)
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>df</span>) +
<span class='fu'>geom_rsi</span>() +
<span class='fu'>scale_y_percent</span>() +
<span class='fu'>scale_rsi_colours</span>() +
<span class='fu'>labels_rsi_count</span>() +
<span class='fu'>theme_rsi</span>()
<span class='co'># or better yet, simplify this using the wrapper function - a single command:</span>
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>()
<span class='co'># get only proportions and no counts:</span>
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>datalabels</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='co'># add other ggplot2 parameters as you like:</span>
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>width</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
<span class='kw'>colour</span> <span class='kw'>=</span> <span class='st'>"black"</span>,
<span class='kw'>size</span> <span class='kw'>=</span> <span class='fl'>1</span>,
<span class='kw'>linetype</span> <span class='kw'>=</span> <span class='fl'>2</span>,
<span class='kw'>alpha</span> <span class='kw'>=</span> <span class='fl'>0.25</span>)
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>colours</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>SI</span> <span class='kw'>=</span> <span class='st'>"yellow"</span>))
<pre class="examples"><span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"ggplot2"</span>) <span class='kw'>&amp;</span> <span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
<span class='co'># get antimicrobial results for drugs against a UTI:</span>
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>)) +
<span class='fu'>geom_rsi</span>()
<span class='co'># prettify the plot using some additional functions:</span>
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>)
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>df</span>) +
<span class='fu'>geom_rsi</span>() +
<span class='fu'>scale_y_percent</span>() +
<span class='fu'>scale_rsi_colours</span>() +
<span class='fu'>labels_rsi_count</span>() +
<span class='fu'>theme_rsi</span>()
<span class='co'># or better yet, simplify this using the wrapper function - a single command:</span>
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>()
<span class='co'># get only proportions and no counts:</span>
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>datalabels</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='co'># add other ggplot2 parameters as you like:</span>
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>, <span class='no'>NIT</span>, <span class='no'>FOS</span>, <span class='no'>TMP</span>, <span class='no'>CIP</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>width</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
<span class='kw'>colour</span> <span class='kw'>=</span> <span class='st'>"black"</span>,
<span class='kw'>size</span> <span class='kw'>=</span> <span class='fl'>1</span>,
<span class='kw'>linetype</span> <span class='kw'>=</span> <span class='fl'>2</span>,
<span class='kw'>alpha</span> <span class='kw'>=</span> <span class='fl'>0.25</span>)
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>AMX</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>colours</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>SI</span> <span class='kw'>=</span> <span class='st'>"yellow"</span>))
}
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {

2
docs/reference/index.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.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>

5
docs/reference/key_antibiotics.html

@ -82,7 +82,7 @@ @@ -82,7 +82,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.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -388,6 +388,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -388,6 +388,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>
<span class='co'># See ?example_isolates.</span>
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
<span class='co'># set key antibiotics to a new variable</span>
<span class='no'>my_patients</span> <span class='kw'>&lt;-</span> <span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
@ -402,7 +403,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -402,7 +403,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='co'># Check the difference, in this data set it results in 7% more isolates:</span>
<span class='fu'><a href='https://rdrr.io/r/base/sum.html'>sum</a></span>(<span class='no'>my_patients</span>$<span class='no'>first_regular</span>, <span class='kw'>na.rm</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
<span class='fu'><a href='https://rdrr.io/r/base/sum.html'>sum</a></span>(<span class='no'>my_patients</span>$<span class='no'>first_weighted</span>, <span class='kw'>na.rm</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)
}
<span class='co'># output of the `key_antibiotics` function could be like this:</span>
<span class='no'>strainA</span> <span class='kw'>&lt;-</span> <span class='st'>"SSSRR.S.R..S"</span>

6
docs/reference/like.html

@ -82,7 +82,7 @@ @@ -82,7 +82,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.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -306,10 +306,12 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s @@ -306,10 +306,12 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<span class='co'>#&gt; TRUE TRUE TRUE</span>
<span class='co'># get isolates whose name start with 'Ent' or 'ent'</span>
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='mo_property.html'>mo_name</a></span>(<span class='no'>mo</span>) <span class='kw'>%like%</span> <span class='st'>"^ent"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://rdrr.io/pkg/cleaner/man/freq.html'>freq</a></span>(<span class='no'>mo</span>)</pre>
<span class='fu'><a href='https://rdrr.io/pkg/cleaner/man/freq.html'>freq</a></span>(<span class='no'>mo</span>)
}</pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top">

6
docs/reference/mdro.html

@ -82,7 +82,7 @@ @@ -82,7 +82,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.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -440,7 +440,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when @@ -440,7 +440,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
<p>On our website <a href='https://msberends.gitlab.io/AMR'>https://msberends.gitlab.io/AMR</a> you can find <a href='https://msberends.gitlab.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.gitlab.io/AMR/reference'>complete documentation of all functions</a> (which reads a lot easier than here in R) and <a href='https://msberends.gitlab.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='co'># \donttest{</span>
<pre class="examples"><span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
@ -451,7 +451,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when @@ -451,7 +451,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>EUCAST</span> <span class='kw'>=</span> <span class='fu'>eucast_exceptional_phenotypes</span>(<span class='no'>.</span>),
<span class='kw'>BRMO</span> <span class='kw'>=</span> <span class='fu'>brmo</span>(<span class='no'>.</span>),
<span class='kw'>MRGN</span> <span class='kw'>=</span> <span class='fu'>mrgn</span>(<span class='no'>.</span>))
<span class='co'># }</span></pre>
}</pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top">

7
docs/reference/proportion.html

@ -83,7 +83,7 @@ resistance() should be used to calculate resistance, susceptibility() should be @@ -83,7 +83,7 @@ resistance() should be used to calculate resistance, susceptibility() should be
</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.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -398,8 +398,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when @@ -398,8 +398,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
<span class='fu'>proportion_IR</span>(<span class='no'>example_isolates</span>$<span class='no'>AMX</span>)
<span class='fu'>proportion_R</span>(<span class='no'>example_isolates</span>$<span class='no'>AMX</span>)
<span class='kw'>if</span> (!<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
<span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
<span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>r</span> <span class='kw'>=</span> <span class='fu'>resistance</span>(<span class='no'>CIP</span>),
@ -456,7 +455,9 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when @@ -456,7 +455,9 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>AMX</span>, <span class='no'>CIP</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>proportion_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
}
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='co'># calculate current empiric combination therapy of Helicobacter gastritis:</span>
<span class='no'>my_table</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,

11
docs/reference/resistance_predict.html

@ -82,7 +82,7 @@ @@ -82,7 +82,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.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9007</span>
</span>
</div>
@ -393,11 +393,12 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when @@ -393,11 +393,12 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
<span class='kw'>year_min</span> <span class='kw'>=</span> <span class='fl'>2010</span>,
<span class='kw'>model</span> <span class='kw'>=</span> <span class='st'>"binomial"</span>)
<span class='fu'><a href='https://rdrr.io/r/base/plot.html'>plot</a></span>(<span class='no'>x</span>)
<span class='fu'>ggplot_rsi_predict</span>(<span class='no'>x</span>)
<span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"ggplot2"</span>)) {
<span class='fu'>ggplot_rsi_predict</span>(<span class='no'>x</span>)
}
<span class='co'># using dplyr:</span>
<span class='kw'>if</span> (!<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
<span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
<span class='no'>x</span> <span class='kw'>&lt;-</span> <span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='first_isolate.html'>filter_first_isolate</a></span>() <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='no'>mo</span>) <span class='kw'>==</span> <span class='st'>"Staphylococcus"</span>) <span class='kw'>%&gt;%</span>
@ -410,7 +411,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when @@ -410,7 +411,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
}
<span class='co'># create nice plots with ggplot2 yourself</span>
<span class='kw'>if</span> (!<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='no'>ggplot2</span>) <span class='kw'>&amp;</span> !<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
<span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='no'>ggplot2</span>) <span class='kw'>&amp;</span> <span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
<span class='no'>data</span> <span class='kw'>&lt;-</span> <span class='no'>example_isolates</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%&gt;%</span>

2
man/as.disk.Rd

@ -38,6 +38,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// @@ -38,6 +38,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
}
\examples{
\dontrun{
# transform existing disk zones to the `disk` class
library(dplyr)
df <- data.frame(microorganism = "E. coli",
@ -56,6 +57,7 @@ as.rsi(x = as.disk(18), @@ -56,6 +57,7 @@ as.rsi(x = as.disk(18),
as.rsi(df)
}
}
\seealso{
\code{\link[=as.rsi]{as.rsi()}}
}

4
man/as.rsi.Rd

@ -110,7 +110,7 @@ df <- data.frame(microorganism = "E. coli", @@ -110,7 +110,7 @@ df <- data.frame(microorganism = "E. coli",
NIT = as.mic(32))
as.rsi(df)
\donttest{
\dontrun{
# the dplyr way
library(dplyr)
@ -157,6 +157,7 @@ is.rsi(rsi_data) @@ -157,6 +157,7 @@ is.rsi(rsi_data)
plot(rsi_data) # for percentages
barplot(rsi_data) # for frequencies
\dontrun{
library(dplyr)
example_isolates \%>\%
mutate_at(vars(PEN:RIF), as.rsi)
@ -173,6 +174,7 @@ example_isolates \%>\% @@ -173,6 +174,7 @@ example_isolates \%>\%
is.rsi.eligible(WHONET$`First name`) # fails, >80\% is invalid
is.rsi.eligible(WHONET$`First name`, threshold = 0.99) # succeeds
}
}
\seealso{
\code{\link[=as.mic]{as.mic()}}
}

2
man/atc_online.Rd

@ -75,7 +75,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// @@ -75,7 +75,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
}
\examples{
\donttest{
\dontrun{
# oral DDD (Defined Daily Dose) of amoxicillin
atc_online_property("J01CA04", "DDD", "O")
# parenteral DDD (Defined Daily Dose) of amoxicillin

2
man/availability.Rd

@ -36,6 +36,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// @@ -36,6 +36,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
\examples{
availability(example_isolates)
\dontrun{
library(dplyr)
example_isolates \%>\% availability()
@ -48,3 +49,4 @@ example_isolates \%>\% @@ -48,3 +49,4 @@ example_isolates \%>\%
select_if(is.rsi) \%>\%
availability()
}
}

2
man/count.Rd

@ -158,7 +158,7 @@ count_susceptible(example_isolates$AMX) @@ -158,7 +158,7 @@ count_susceptible(example_isolates$AMX)
susceptibility(example_isolates$AMX) * n_rsi(example_isolates$AMX)
if (!require("dplyr")) {
if (require("dplyr")) {
example_isolates \%>\%
group_by(hospital_id) \%>\%
summarise(R = count_R(CIP),

77
man/ggplot_rsi.Rd

@ -147,44 +147,45 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// @@ -147,44 +147,45 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
}
\examples{
library(dplyr)
library(ggplot2)
# get antimicrobial results for drugs against a UTI:
ggplot(example_isolates \%>\% select(AMX, NIT, FOS, TMP, CIP)) +
geom_rsi()
# prettify the plot using some additional functions:
df <- example_isolates \%>\% select(AMX, NIT, FOS, TMP, CIP)
ggplot(df) +
geom_rsi() +
scale_y_percent() +
scale_rsi_colours() +
labels_rsi_count() +
theme_rsi()
# or better yet, simplify this using the wrapper function - a single command:
example_isolates \%>\%
select(AMX, NIT, FOS, TMP, CIP) \%>\%
ggplot_rsi()
# get only proportions and no counts:
example_isolates \%>\%
select(AMX, NIT, FOS, TMP, CIP) \%>\%
ggplot_rsi(datalabels = FALSE)
# add other ggplot2 parameters as you like:
example_isolates \%>\%
select(AMX, NIT, FOS, TMP, CIP) \%>\%
ggplot_rsi(width = 0.5,
colour = "black",
size = 1,
linetype = 2,
alpha = 0.25)
example_isolates \%>\%
select(AMX) \%>\%
ggplot_rsi(colours = c(SI = "yellow"))
if (require("ggplot2") & require("dplyr")) {
# get antimicrobial results for drugs against a UTI:
ggplot(example_isolates \%>\% select(AMX, NIT, FOS, TMP, CIP)) +
geom_rsi()
# prettify the plot using some additional functions:
df <- example_isolates \%>\% select(AMX, NIT, FOS, TMP, CIP)
ggplot(df) +
geom_rsi() +
scale_y_percent() +
scale_rsi_colours() +
labels_rsi_count() +
theme_rsi()
# or better yet, simplify this using the wrapper function - a single command:
example_isolates \%>\%
select(AMX, NIT, FOS, TMP, CIP) \%>\%
ggplot_rsi()
# get only proportions and no counts:
example_isolates \%>\%
select(AMX, NIT, FOS, TMP, CIP) \%>\%
ggplot_rsi(datalabels = FALSE)
# add other ggplot2 parameters as you like:
example_isolates \%>\%
select(AMX, NIT, FOS, TMP, CIP) \%>\%
ggplot_rsi(width = 0.5,
colour = "black",
size = 1,
linetype = 2,
alpha = 0.25)
example_isolates \%>\%
select(AMX) \%>\%
ggplot_rsi(colours = c(SI = "yellow"))
}
\dontrun{

3
man/key_antibiotics.Rd

@ -136,6 +136,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// @@ -136,6 +136,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
# `example_isolates` is a dataset available in the AMR package.
# See ?example_isolates.
\dontrun{
library(dplyr)
# set key antibiotics to a new variable
my_patients <- example_isolates \%>\%
@ -150,7 +151,7 @@ my_patients <- example_isolates \%>\% @@ -150,7 +151,7 @@ my_patients <- example_isolates \%>\%
# Check the difference, in this data set it results in 7\% more isolates:
sum(my_patients$first_regular, na.rm = TRUE)
sum(my_patients$first_weighted, na.rm = TRUE)
}
# output of the `key_antibiotics` function could be like this:
strainA <- "SSSRR.S.R..S"

2
man/like.Rd

@ -68,11 +68,13 @@ a \%like\% b @@ -68,11 +68,13 @@ a \%like\% b
#> TRUE TRUE TRUE
# get isolates whose name start with 'Ent' or 'ent'
\dontrun{
library(dplyr)
example_isolates \%>\%
filter(mo_name(mo) \%like\% "^ent") \%>\%
freq(mo)
}
}
\seealso{
\code{\link[base:grep]{base::grep()}}
}

2
man/mdro.Rd

@ -206,7 +206,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// @@ -206,7 +206,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
}
\examples{
\donttest{
\dontrun{
library(dplyr)