Browse Source

(v1.3.0.9017) small fix

new-mo-algorithm
parent
commit
0f6760d427
  1. 2
      DESCRIPTION
  2. 2
      NEWS.md
  3. 74
      R/mo.R
  4. BIN
      data-raw/antibiotics.dta
  5. BIN
      data-raw/antibiotics.sas
  6. BIN
      data-raw/antibiotics.sav
  7. BIN
      data-raw/antibiotics.xlsx
  8. BIN
      data-raw/antivirals.dta
  9. BIN
      data-raw/antivirals.sas
  10. BIN
      data-raw/antivirals.sav
  11. BIN
      data-raw/antivirals.xlsx
  12. BIN
      data-raw/intrinsic_resistant.dta
  13. BIN
      data-raw/intrinsic_resistant.sas
  14. BIN
      data-raw/intrinsic_resistant.sav
  15. BIN
      data-raw/intrinsic_resistant.xlsx
  16. BIN
      data-raw/microorganisms.dta
  17. BIN
      data-raw/microorganisms.old.dta
  18. BIN
      data-raw/microorganisms.old.sas
  19. BIN
      data-raw/microorganisms.old.sav
  20. BIN
      data-raw/microorganisms.old.xlsx
  21. BIN
      data-raw/microorganisms.sas
  22. BIN
      data-raw/microorganisms.sav
  23. BIN
      data-raw/microorganisms.xlsx
  24. BIN
      data-raw/rsi_translation.dta
  25. BIN
      data-raw/rsi_translation.sas
  26. BIN
      data-raw/rsi_translation.sav
  27. BIN
      data-raw/rsi_translation.xlsx
  28. 2
      docs/404.html
  29. 2
      docs/LICENSE-text.html
  30. 2
      docs/articles/index.html
  31. 2
      docs/authors.html
  32. 2
      docs/index.html
  33. 8
      docs/news/index.html
  34. 2
      docs/pkgdown.yml
  35. 2
      docs/reference/index.html
  36. 2
      docs/survey.html
  37. 1
      tests/testthat.R

2
DESCRIPTION

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Package: AMR
Version: 1.3.0.9016
Version: 1.3.0.9017
Date: 2020-09-12
Title: Antimicrobial Resistance Analysis
Authors@R: c(

2
NEWS.md

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# AMR 1.3.0.9016
# AMR 1.3.0.9017
## <small>Last updated: 12 September 2020</small>
Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscipt to. We are those reviewers very grateful for going through our code so thoroughly!

74
R/mo.R

@ -281,6 +281,43 @@ exec_as.mo <- function(x, @@ -281,6 +281,43 @@ exec_as.mo <- function(x,
reference_data_to_use = MO_lookup) {
check_dataset_integrity()
lookup <- function(needle, column = property, haystack = reference_data_to_use, n = 1, debug_mode = debug, input = "") {
# `column` can be NULL for all columns, or a selection
# returns a character (vector) - if `column` > length 1 then with columns as names
if (isTRUE(debug_mode)) {
cat(font_silver("looking up: ", substitute(needle), "\n", collapse = ""))
}
if (length(column) == 1) {
res_df <- haystack[which(eval(substitute(needle), envir = haystack, enclos = parent.frame())), , drop = FALSE]
res <- as.character(res_df[, column, drop = TRUE])
if (length(res) == 0) {
NA_character_
} else {
if (length(res) > n) {
# save the other possible results as well
uncertainties <<- rbind(uncertainties,
format_uncertainty_as_df(uncertainty_level = 1,
input = x_backup[i],
result_mo = res_df[1, "mo", drop = TRUE],
candidates = as.character(res_df[, "fullname", drop = TRUE])))
}
res[seq_len(min(n, length(res)))]
}
} else {
if (is.null(column)) {
column <- names(haystack)
}
res <- haystack[which(eval(substitute(needle), envir = haystack, enclos = parent.frame())), , drop = FALSE]
res <- res[seq_len(min(n, nrow(res))), column, drop = TRUE]
if (NROW(res) == 0) {
res <- rep(NA_character_, length(column))
}
res <- as.character(res)
names(res) <- column
res
}
}
# start off with replaced language-specific non-ASCII characters with ASCII characters
x <- parse_and_convert(x)
@ -383,43 +420,6 @@ exec_as.mo <- function(x, @@ -383,43 +420,6 @@ exec_as.mo <- function(x,
} else if (!all(x %in% microorganisms[, property])) {
lookup <- function(needle, column = property, haystack = reference_data_to_use, n = 1, debug_mode = debug, input = "") {
# `column` can be NULL for all columns, or a selection
# returns a character (vector) - if `column` > length 1 then with columns as names
if (isTRUE(debug_mode)) {
cat(font_silver("looking up: ", substitute(needle), "\n", collapse = ""))
}
if (length(column) == 1) {
res_df <- haystack[which(eval(substitute(needle), envir = haystack, enclos = parent.frame())), , drop = FALSE]
res <- as.character(res_df[, column, drop = TRUE])
if (length(res) == 0) {
NA_character_
} else {
if (length(res) > n) {
# save the other possible results as well
uncertainties <<- rbind(uncertainties,
format_uncertainty_as_df(uncertainty_level = 1,
input = x_backup[i],
result_mo = res_df[1, "mo", drop = TRUE],
candidates = as.character(res_df[, "fullname", drop = TRUE])))
}
res[seq_len(min(n, length(res)))]
}
} else {
if (is.null(column)) {
column <- names(haystack)
}
res <- haystack[which(eval(substitute(needle), envir = haystack, enclos = parent.frame())), , drop = FALSE]
res <- res[seq_len(min(n, nrow(res))), column, drop = TRUE]
if (NROW(res) == 0) {
res <- rep(NA_character_, length(column))
}
res <- as.character(res)
names(res) <- column
res
}
}
strip_whitespace <- function(x, dyslexia_mode) {
# all whitespaces (tab, new lines, etc.) should be one space
# and spaces before and after should be omitted

BIN
data-raw/antibiotics.dta

Binary file not shown.

BIN
data-raw/antibiotics.sas

Binary file not shown.

BIN
data-raw/antibiotics.sav

Binary file not shown.

BIN
data-raw/antibiotics.xlsx

Binary file not shown.

BIN
data-raw/antivirals.dta

Binary file not shown.

BIN
data-raw/antivirals.sas

Binary file not shown.

BIN
data-raw/antivirals.sav

Binary file not shown.

BIN
data-raw/antivirals.xlsx

Binary file not shown.

BIN
data-raw/intrinsic_resistant.dta

Binary file not shown.

BIN
data-raw/intrinsic_resistant.sas

Binary file not shown.

BIN
data-raw/intrinsic_resistant.sav

Binary file not shown.

BIN
data-raw/intrinsic_resistant.xlsx

Binary file not shown.

BIN
data-raw/microorganisms.dta

Binary file not shown.

BIN
data-raw/microorganisms.old.dta

Binary file not shown.

BIN
data-raw/microorganisms.old.sas

Binary file not shown.

BIN
data-raw/microorganisms.old.sav

Binary file not shown.

BIN
data-raw/microorganisms.old.xlsx

Binary file not shown.

BIN
data-raw/microorganisms.sas

Binary file not shown.

BIN
data-raw/microorganisms.sav

Binary file not shown.

BIN
data-raw/microorganisms.xlsx

Binary file not shown.

BIN
data-raw/rsi_translation.dta

Binary file not shown.

BIN
data-raw/rsi_translation.sas

Binary file not shown.

BIN
data-raw/rsi_translation.sav

Binary file not shown.

BIN
data-raw/rsi_translation.xlsx

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

8
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.3.0.9016</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9017</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-1309016" class="section level1">
<h1 class="page-header" data-toc-text="1.3.0.9016">
<a href="#amr-1309016" class="anchor"></a>AMR 1.3.0.9016<small> Unreleased </small>
<div id="amr-1309017" class="section level1">
<h1 class="page-header" data-toc-text="1.3.0.9017">
<a href="#amr-1309017" class="anchor"></a>AMR 1.3.0.9017<small> Unreleased </small>
</h1>
<div id="last-updated-12-september-2020" class="section level2">
<h2 class="hasAnchor">

2
docs/pkgdown.yml

@ -2,7 +2,7 @@ pandoc: 2.7.3 @@ -2,7 +2,7 @@ pandoc: 2.7.3
pkgdown: 1.5.1.9000
pkgdown_sha: eae56f08694abebf93cdfc0dd8e9ede06d8c815f
articles: []
last_built: 2020-09-12T06:48Z
last_built: 2020-09-12T11:54Z
urls:
reference: https://msberends.github.io/AMR/reference
article: https://msberends.github.io/AMR/articles

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

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

1
tests/testthat.R

@ -23,3 +23,4 @@ library(testthat) @@ -23,3 +23,4 @@ library(testthat)
library(AMR)
test_check("AMR")
unlink("tests/testthat/Rplots.pdf")

Loading…
Cancel
Save