Browse Source

(v1.6.0.9016) website update and c() fixes

new-mo-algorithm
parent
commit
f33e61bac7
  1. 2
      DESCRIPTION
  2. 2
      NEWS.md
  3. 2
      R/aa_helper_functions.R
  4. 9
      R/ab.R
  5. 7
      R/disk.R
  6. 5
      R/italicise_taxonomy.R
  7. 6
      R/mic.R
  8. 31
      R/mo.R
  9. 1
      _pkgdown.yml
  10. BIN
      data-raw/AMR_latest.tar.gz
  11. 2
      docs/404.html
  12. 2
      docs/LICENSE-text.html
  13. 2
      docs/articles/index.html
  14. 2
      docs/authors.html
  15. BIN
      docs/countries.png
  16. BIN
      docs/countries_large.png
  17. 4
      docs/index.html
  18. 12
      docs/news/index.html
  19. 2
      docs/pkgdown.yml
  20. 8
      docs/reference/index.html
  21. 2
      docs/survey.html
  22. 4
      index.md
  23. BIN
      pkgdown/logos/countries.png
  24. BIN
      pkgdown/logos/countries_large.png
  25. 39
      tests/testthat/test-italicise_taxonomy.R

2
DESCRIPTION

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Package: AMR
Version: 1.6.0.9015
Version: 1.6.0.9016
Date: 2021-05-03
Title: Antimicrobial Resistance Data Analysis
Authors@R: c(

2
NEWS.md

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# `AMR` 1.6.0.9015
# `AMR` 1.6.0.9016
## <small>Last updated: 3 May 2021</small>
### New

2
R/aa_helper_functions.R

@ -458,7 +458,7 @@ stop_ifnot <- function(expr, ..., call = TRUE) { @@ -458,7 +458,7 @@ stop_ifnot <- function(expr, ..., call = TRUE) {
ifelse(!is.na(y), y, NA))
}
class_integrity_check <- function(value, type, check_vector) {
return_after_integrity_check <- function(value, type, check_vector) {
if (!all(value[!is.na(value)] %in% check_vector)) {
warning_(paste0("invalid ", type, ", NA generated"), call = FALSE)
value[!value %in% check_vector] <- NA

9
R/ab.R

@ -551,7 +551,7 @@ as.data.frame.ab <- function(x, ...) { @@ -551,7 +551,7 @@ as.data.frame.ab <- function(x, ...) {
"[<-.ab" <- function(i, j, ..., value) {
y <- NextMethod()
attributes(y) <- attributes(i)
class_integrity_check(y, "antimicrobial code", antibiotics$ab)
return_after_integrity_check(y, "antimicrobial code", antibiotics$ab)
}
#' @method [[<- ab
#' @export
@ -559,15 +559,16 @@ as.data.frame.ab <- function(x, ...) { @@ -559,15 +559,16 @@ as.data.frame.ab <- function(x, ...) {
"[[<-.ab" <- function(i, j, ..., value) {
y <- NextMethod()
attributes(y) <- attributes(i)
class_integrity_check(y, "antimicrobial code", antibiotics$ab)
return_after_integrity_check(y, "antimicrobial code", antibiotics$ab)
}
#' @method c ab
#' @export
#' @noRd
c.ab <- function(x, ...) {
c.ab <- function(...) {
x <- list(...)[[1L]]
y <- NextMethod()
attributes(y) <- attributes(x)
class_integrity_check(y, "antimicrobial code", antibiotics$ab)
return_after_integrity_check(y, "antimicrobial code", antibiotics$ab)
}
#' @method unique ab

7
R/disk.R

@ -182,11 +182,8 @@ print.disk <- function(x, ...) { @@ -182,11 +182,8 @@ print.disk <- function(x, ...) {
#' @method c disk
#' @export
#' @noRd
c.disk <- function(x, ...) {
y <- NextMethod()
y <- as.disk(y)
attributes(y) <- attributes(x)
y
c.disk <- function(...) {
as.disk(unlist(lapply(list(...), as.character)))
}
#' @method unique disk

5
R/italicise_taxonomy.R

@ -115,5 +115,8 @@ italicise_taxonomy <- function(string, type = c("markdown", "ansi")) { @@ -115,5 +115,8 @@ italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
#' @rdname italicise_taxonomy
#' @export
italicize_taxonomy <- function(string, type = c("markdown", "ansi")) {
italicise(string = string, type = type)
if (missing(type)) {
type <- "markdown"
}
italicise_taxonomy(string = string, type = type)
}

6
R/mic.R

@ -307,10 +307,8 @@ as.matrix.mic <- function(x, ...) { @@ -307,10 +307,8 @@ as.matrix.mic <- function(x, ...) {
#' @method c mic
#' @export
#' @noRd
c.mic <- function(x, ...) {
y <- unlist(lapply(list(...), as.character))
x <- as.character(x)
as.mic(c(x, y))
c.mic <- function(...) {
as.mic(unlist(lapply(list(...), as.character)))
}
#' @method unique mic

31
R/mo.R

@ -1677,7 +1677,7 @@ pillar_shaft.mo <- function(x, ...) { @@ -1677,7 +1677,7 @@ pillar_shaft.mo <- function(x, ...) {
} else {
col <- "The data"
}
warning_(col, " contains old microbial codes (from a previous AMR package version). ",
warning_(col, " contains old MO codes (from a previous AMR package version). ",
"Please update your MO codes with `as.mo()`.",
call = FALSE)
}
@ -1751,6 +1751,11 @@ print.mo <- function(x, print.shortnames = FALSE, ...) { @@ -1751,6 +1751,11 @@ print.mo <- function(x, print.shortnames = FALSE, ...) {
}
x <- as.character(x)
names(x) <- x_names
if (!all(x[!is.na(x)] %in% MO_lookup$mo)) {
warning_("Some MO codes are from a previous AMR package version. ",
"Please update these MO codes with `as.mo()`.",
call = FALSE)
}
print.default(x, quote = FALSE)
}
@ -1777,7 +1782,7 @@ summary.mo <- function(object, ...) { @@ -1777,7 +1782,7 @@ summary.mo <- function(object, ...) {
#' @noRd
as.data.frame.mo <- function(x, ...) {
if (!all(x[!is.na(x)] %in% MO_lookup$mo)) {
warning_("The data contains old microbial codes (from a previous AMR package version). ",
warning_("The data contains old MO codes (from a previous AMR package version). ",
"Please update your MO codes with `as.mo()`.",
call = FALSE)
}
@ -1812,8 +1817,8 @@ as.data.frame.mo <- function(x, ...) { @@ -1812,8 +1817,8 @@ as.data.frame.mo <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(i)
# must only contain valid MOs
class_integrity_check(y, "microorganism code", c(as.character(microorganisms$mo),
as.character(microorganisms.translation$mo_old)))
return_after_integrity_check(y, "microorganism code", c(as.character(microorganisms$mo),
as.character(microorganisms.translation$mo_old)))
}
#' @method [[<- mo
#' @export
@ -1822,18 +1827,18 @@ as.data.frame.mo <- function(x, ...) { @@ -1822,18 +1827,18 @@ as.data.frame.mo <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(i)
# must only contain valid MOs
class_integrity_check(y, "microorganism code", c(as.character(microorganisms$mo),
as.character(microorganisms.translation$mo_old)))
return_after_integrity_check(y, "microorganism code", c(as.character(microorganisms$mo),
as.character(microorganisms.translation$mo_old)))
}
#' @method c mo
#' @export
#' @noRd
c.mo <- function(x, ...) {
c.mo <- function(...) {
x <- list(...)[[1L]]
y <- NextMethod()
attributes(y) <- attributes(x)
# must only contain valid MOs
class_integrity_check(y, "microorganism code", c(as.character(microorganisms$mo),
as.character(microorganisms.translation$mo_old)))
return_after_integrity_check(y, "microorganism code", c(as.character(microorganisms$mo),
as.character(microorganisms.translation$mo_old)))
}
#' @method unique mo
@ -2058,10 +2063,10 @@ replace_old_mo_codes <- function(x, property) { @@ -2058,10 +2063,10 @@ replace_old_mo_codes <- function(x, property) {
n_matched <- length(matched[!is.na(matched)])
if (property != "mo") {
message_(font_blue(paste0("The input contained ", n_matched,
" old microbial code", ifelse(n_matched == 1, "", "s"),
" old MO code", ifelse(n_matched == 1, "", "s"),
" (from a previous AMR package version). Please update your MO codes with `as.mo()`.")))
} else {
message_(font_blue(paste0(n_matched, " old microbial code", ifelse(n_matched == 1, "", "s"),
message_(font_blue(paste0(n_matched, " old MO code", ifelse(n_matched == 1, "", "s"),
" (from a previous AMR package version) ",
ifelse(n_matched == 1, "was", "were"),
" updated to ", ifelse(n_matched == 1, "a ", ""),
@ -2100,7 +2105,7 @@ repair_reference_df <- function(reference_df) { @@ -2100,7 +2105,7 @@ repair_reference_df <- function(reference_df) {
reference_df[, "x"] <- as.character(reference_df[, "x", drop = TRUE])
reference_df[, "mo"] <- as.character(reference_df[, "mo", drop = TRUE])
# some microbial codes might be old
# some MO codes might be old
reference_df[, "mo"] <- as.mo(reference_df[, "mo", drop = TRUE])
reference_df
}

1
_pkgdown.yml

@ -177,6 +177,7 @@ reference: @@ -177,6 +177,7 @@ reference:
- "`availability`"
- "`get_locale`"
- "`ggplot_pca`"
- "`italicise_taxonomy`"
- "`join`"
- "`like`"
- "`mo_matching_score`"

BIN
data-raw/AMR_latest.tar.gz

Binary file not shown.

2
docs/404.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.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.6.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9016</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.6.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9016</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.6.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9016</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.6.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9016</span>
</span>
</div>

BIN
docs/countries.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

BIN
docs/countries_large.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

4
docs/index.html

@ -42,7 +42,7 @@ @@ -42,7 +42,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.6.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9016</span>
</span>
</div>
@ -206,7 +206,7 @@ @@ -206,7 +206,7 @@
<p>This package is <a href="https://en.wikipedia.org/wiki/Dependency_hell">fully independent of any other R package</a> and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). <strong>It was designed to work in any setting, including those with very limited resources</strong>. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the <a href="https://www.rug.nl">University of Groningen</a>, in collaboration with non-profit organisations <a href="https://www.certe.nl">Certe Medical Diagnostics and Advice Foundation</a> and <a href="https://www.umcg.nl">University Medical Center Groningen</a>. This R package is <a href="./news">actively maintained</a> and is free software (see <a href="#copyright">Copyright</a>).</p>
<div class="main-content" style="display: inline-block;">
<p>
<a href="./countries_large.png" target="_blank"><img src="./countries.png" class="countries_map"></a> <strong>Used in 155 countries</strong><br> Since its first public release in early 2018, this package has been downloaded from 155 countries. Click the map to enlarge and to see the country names.
<a href="./countries_large.png" target="_blank"><img src="./countries.png" class="countries_map"></a> <strong>Used in 162 countries</strong><br> Since its first public release in early 2018, this package has been downloaded from 162 countries. Click the map to enlarge and to see the country names.
</p>
</div>
<div id="with-amr-for-r-theres-always-a-knowledgeable-microbiologist-by-your-side" class="section level5">

12
docs/news/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.6.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9016</span>
</span>
</div>
@ -236,9 +236,9 @@ @@ -236,9 +236,9 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1609015" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9015">
<a href="#amr-1609015" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9015</h1>
<div id="amr-1609016" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9016">
<a href="#amr-1609016" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9016</h1>
<div id="last-updated-3-may-2021" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-3-may-2021" class="anchor"></a><small>Last updated: 3 May 2021</small>
@ -340,7 +340,7 @@ @@ -340,7 +340,7 @@
<span class="co">#&gt; Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"</span></code></pre></div>
</li>
<li><p>Support for custom MDRO guidelines, using the new <code><a href="../reference/mdro.html">custom_mdro_guideline()</a></code> function, please see <code><a href="../reference/mdro.html">mdro()</a></code> for additional info</p></li>
<li><p><code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> generics for classes <code>&lt;mic&gt;</code> and <code>&lt;disk&gt;</code></p></li>
<li><p><code>ggplot()</code> generics for classes <code>&lt;mic&gt;</code> and <code>&lt;disk&gt;</code></p></li>
<li>
<p>Function <code><a href="../reference/mo_property.html">mo_is_yeast()</a></code>, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
@ -397,7 +397,7 @@ @@ -397,7 +397,7 @@
<li>Plotting of MIC and disk diffusion values now support interpretation colouring if you supply the microorganism and antimicrobial agent</li>
<li>All colours were updated to colour-blind friendly versions for values R, S and I for all plot methods (also applies to tibble printing)</li>
<li>Interpretation of MIC and disk diffusion values to R/SI will now be translated if the system language is German, Dutch or Spanish (see <code>translate</code>)</li>
<li>Plotting is now possible with base R using <code><a href="../reference/plot.html">plot()</a></code> and with ggplot2 using <code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> on any vector of MIC and disk diffusion values</li>
<li>Plotting is now possible with base R using <code><a href="../reference/plot.html">plot()</a></code> and with ggplot2 using <code>ggplot()</code> on any vector of MIC and disk diffusion values</li>
</ul>
</li>
<li>Updated SNOMED codes to US Edition of SNOMED CT from 1 September 2020 and added the source to the help page of the <code>microorganisms</code> data set</li>

2
docs/pkgdown.yml

@ -12,7 +12,7 @@ articles: @@ -12,7 +12,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
last_built: 2021-05-03T08:19Z
last_built: 2021-05-03T11:04Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles

8
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.6.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9016</span>
</span>
</div>
@ -592,6 +592,12 @@ @@ -592,6 +592,12 @@
<td><p>PCA Biplot with <code>ggplot2</code></p></td>
</tr><tr>
<td>
<p><code><a href="italicise_taxonomy.html">italicise_taxonomy()</a></code> <code><a href="italicise_taxonomy.html">italicize_taxonomy()</a></code> </p>
</td>
<td><p>Italicise Taxonomic Families, Genera, Species, Subspecies</p></td>
</tr><tr>
<td>
<p><code><a href="join.html">inner_join_microorganisms()</a></code> <code><a href="join.html">left_join_microorganisms()</a></code> <code><a href="join.html">right_join_microorganisms()</a></code> <code><a href="join.html">full_join_microorganisms()</a></code> <code><a href="join.html">semi_join_microorganisms()</a></code> <code><a href="join.html">anti_join_microorganisms()</a></code> </p>
</td>

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

4
index.md

@ -15,8 +15,8 @@ This package is [fully independent of any other R package](https://en.wikipedia. @@ -15,8 +15,8 @@ This package is [fully independent of any other R package](https://en.wikipedia.
<div class="main-content" style="display: inline-block;">
<p>
<a href="./countries_large.png" target="_blank"><img src="./countries.png" class="countries_map"></a>
<strong>Used in 155 countries</strong><br>
Since its first public release in early 2018, this package has been downloaded from 155 countries. Click the map to enlarge and to see the country names.</p>
<strong>Used in 162 countries</strong><br>
Since its first public release in early 2018, this package has been downloaded from 162 countries. Click the map to enlarge and to see the country names.</p>
</div>
##### With `AMR` (for R), there's always a knowledgeable microbiologist by your side!

BIN
pkgdown/logos/countries.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

BIN
pkgdown/logos/countries_large.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

39
tests/testthat/test-italicise_taxonomy.R

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Data Analysis for R #
# #
# SOURCE #
# https://github.com/msberends/AMR #
# #
# LICENCE #
# (c) 2018-2021 Berends MS, Luz CF et al. #
# Developed at the University of Groningen, the Netherlands, in #
# collaboration with non-profit organisations Certe Medical #
# Diagnostics & Advice, and University Medical Center Groningen. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# We created this package for both routine data analysis and academic #
# research and it was publicly released in the hope that it will be #
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
# #
# Visit our website for the full manual and a complete tutorial about #
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
context("italicise_taxonomy.R")
test_that("italic taxonomy works", {
skip_on_cran()
expect_identical(italicise_taxonomy("test for E. coli"),
"test for *E. coli*")
expect_identical(italicise_taxonomy("test for E. coli"),
italicize_taxonomy("test for E. coli"))
if (has_colour()) {
expect_identical(italicise_taxonomy("test for E. coli", type = "ansi"),
"test for \033[3mE. coli\033[23m")
}
})
Loading…
Cancel
Save