Browse Source

(v1.6.0.9050) printing NA in custom_eucast_rules()

main
parent
commit
04ef5b28e7
  1. 22
      .github/workflows/check.yaml
  2. 4
      DESCRIPTION
  3. 4
      NEWS.md
  4. 2
      R/atc_online.R
  5. 7
      R/custom_eucast_rules.R
  6. BIN
      data-raw/AMR_latest.tar.gz
  7. 33
      data-raw/_install_deps.R
  8. 2
      docs/404.html
  9. 2
      docs/LICENSE-text.html
  10. 4
      docs/articles/datasets.html
  11. 2
      docs/articles/index.html
  12. 2
      docs/authors.html
  13. 2
      docs/index.html
  14. 12
      docs/news/index.html
  15. 2
      docs/pkgdown.yml
  16. 4
      docs/reference/atc_online.html
  17. 2
      docs/reference/index.html
  18. 2
      docs/survey.html
  19. 5
      inst/tinytest/test-atc_online.R
  20. 20
      inst/tinytest/test-proportion.R
  21. 2
      man/atc_online.Rd

22
.github/workflows/check.yaml

@ -96,7 +96,7 @@ jobs: @@ -96,7 +96,7 @@ jobs:
- name: Install Linux dependencies
if: runner.os == 'Linux'
# update the below with sysreqs::sysreqs("DESCRIPTION") and check the "DEB" entries (for Ubuntu).
# we don't want to depend on the sysreqs pkg here, as it requires a quite new R version
# we don't want to depend on the sysreqs pkg here, as it requires quite a recent R version
# as of May 2021: https://sysreqs.r-hub.io/pkg/AMR,R,cleaner,curl,dplyr,ggplot2,ggtext,knitr,microbenchmark,pillar,readxl,rmarkdown,rstudioapi,rvest,skimr,tidyr,tinytest,xml2,backports,crayon,rlang,vctrs,evaluate,highr,markdown,stringr,yaml,xfun,cli,ellipsis,fansi,lifecycle,utf8,glue,mime,magrittr,stringi,generics,R6,tibble,tidyselect,pkgconfig,purrr,digest,gtable,isoband,MASS,mgcv,scales,withr,nlme,Matrix,farver,labeling,munsell,RColorBrewer,viridisLite,lattice,colorspace,gridtext,Rcpp,RCurl,png,jpeg,bitops,cellranger,progress,rematch,hms,prettyunits,htmltools,jsonlite,tinytex,base64enc,httr,selectr,openssl,askpass,sys,repr,cpp11
run: |
sudo apt install -y libssl-dev pandoc pandoc-citeproc libxml2-dev libicu-dev libcurl4-openssl-dev libpng-dev
@ -109,29 +109,33 @@ jobs: @@ -109,29 +109,33 @@ jobs:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-r-${{ matrix.config.r }}-v4
- name: Install AMR and tinytest and update dependencies
- name: Unpack AMR and install R dependencies
if: always()
run: |
tar -xf data-raw/AMR_latest.tar.gz
source("data-raw/_install_deps.R")
shell: Rscript {0}
- name: Show session info
if: always()
run: |
options(width = 100)
utils::sessionInfo()
as.data.frame(utils::installed.packages())[, "Version", drop = FALSE]
shell: Rscript {0}
- name: Unpack shipped version and remove vignettes
if: always()
- name: Only keep vignettes on release version
if: matrix.config.r != 'release'
# writing to DESCRIPTION2 and then moving to DESCRIPTION is required for R < 3.3 as writeLines() cannot overwrite
run: |
tar -xf data-raw/AMR_latest.tar.gz
rm -rf AMR/vignettes
Rscript -e "writeLines(readLines('AMR/DESCRIPTION')[!grepl('VignetteBuilder', readLines('AMR/DESCRIPTION'))], 'AMR/DESCRIPTION')"
Rscript -e "writeLines(readLines('AMR/DESCRIPTION')[gsub(' +', '', readLines('AMR/DESCRIPTION')) != ''], 'AMR/DESCRIPTION')"
find AMR -name 'DESCRIPTION' -exec cat '{}' \; || true
Rscript -e "writeLines(readLines('AMR/DESCRIPTION')[!grepl('VignetteBuilder', readLines('AMR/DESCRIPTION'))], 'AMR/DESCRIPTION2')"
rm AMR/DESCRIPTION
mv AMR/DESCRIPTION2 AMR/DESCRIPTION
shell: bash
- name: Run R CMD check
if: always()
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_: false
@ -142,7 +146,7 @@ jobs: @@ -142,7 +146,7 @@ jobs:
R_LIBS_USER_GH_ACTIONS: ${{ env.R_LIBS_USER }}
R_RUN_TINYTEST: true
run: |
R CMD check --no-manual --no-vignettes --no-build-vignettes --ignore-vignettes AMR
R CMD check --no-manual AMR
shell: bash
- name: Show unit tests output

4
DESCRIPTION

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Package: AMR
Version: 1.6.0.9049
Date: 2021-05-19
Version: 1.6.0.9050
Date: 2021-05-20
Title: Antimicrobial Resistance Data Analysis
Authors@R: c(
person(role = c("aut", "cre"),

4
NEWS.md

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
# `AMR` 1.6.0.9049
## <small>Last updated: 19 May 2021</small>
# `AMR` 1.6.0.9050
## <small>Last updated: 20 May 2021</small>
### Breaking change
* All antibiotic class selectors (such as `carbapenems()`, `aminoglycosides()`) can now be used for filtering as well, making all their accompanying `filter_*()` functions redundant (such as `filter_carbapenems()`, `filter_aminoglycosides()`). These functions are now deprecated and will be removed in a next release.

2
R/atc_online.R

@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
#' - `"TU"` = thousand units
#' - `"MU"` = million units
#' - `"mmol"` = millimole
#' - `"ml"` = milliliter (e.g. eyedrops)
#' - `"ml"` = millilitre (e.g. eyedrops)
#'
#' **N.B. This function requires an internet connection and only works if the following packages are installed: `curl`, `rvest`, `xml2`.**
#' @export

7
R/custom_eucast_rules.R

@ -108,7 +108,7 @@ @@ -108,7 +108,7 @@
#' custom_eucast_rules(TZP == "R" ~ carbapenems == "R"))
#' x2
custom_eucast_rules <- function(...) {
dots <- tryCatch(list(...),
error = function(e) "error")
stop_if(identical(dots, "error"),
@ -150,7 +150,6 @@ custom_eucast_rules <- function(...) { @@ -150,7 +150,6 @@ custom_eucast_rules <- function(...) {
result_group <- tryCatch(
suppressWarnings(as.ab(result_group,
fast_mode = TRUE,
info = FALSE,
flag_multiple_results = FALSE)),
error = function(e) NA_character_)
}
@ -203,7 +202,9 @@ print.custom_eucast_rules <- function(x, ...) { @@ -203,7 +202,9 @@ print.custom_eucast_rules <- function(x, ...) {
for (i in seq_len(length(x))) {
rule <- x[[i]]
rule$query <- format_custom_query_rule(rule$query)
if (rule$result_value == "R") {
if (is.na(rule$result_value)) {
val <- font_red("<NA>")
} else if (rule$result_value == "R") {
val <- font_rsi_R_bg(font_black(" R "))
} else if (rule$result_value == "S") {
val <- font_rsi_S_bg(font_black(" S "))

BIN
data-raw/AMR_latest.tar.gz

Binary file not shown.

33
data-raw/_install_deps.R

@ -23,32 +23,31 @@ @@ -23,32 +23,31 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
# some old R instances have trouble installing tinytest, so we ship it too
install.packages("data-raw/tinytest_1.2.4.patched.tar.gz")
pkg_suggests <- AMR:::trimws(unlist(strsplit(packageDescription("AMR")$Suggests, ",(\n)?")))
descr <- readLines("AMR/DESCRIPTION")
pkg_suggests <- gsub(".*Suggests: (.*)*?[A-Z].*", "\\1", paste0(descr, "*", collapse = ""), perl = FALSE)
pkg_suggests <- unlist(strsplit(pkg_suggests, "[,* ]"))
pkg_suggests <- pkg_suggests[pkg_suggests != ""]
cat("Packages listed in Suggests:", paste(pkg_suggests, collapse = ", "), "\n")
to_install <- pkg_suggests[!pkg_suggests %in% rownames(utils::installed.packages())]
to_update <- as.data.frame(utils::old.packages(repos = "https://cran.rstudio.com/"), stringsAsFactors = FALSE)
to_update <- to_update[which(to_update$Package %in% pkg_suggests), "Package", drop = TRUE]
for (i in seq_len(length(to_install))) {
if (isTRUE(is.character(to_install[i]))) {
cat("Installing package", to_install[i], "\n")
tryCatch(install.packages(to_install[i], repos = "https://cran.rstudio.com/", dependencies = TRUE, quiet = TRUE),
# message = function(m) invisible(),
warning = function(w) message(w$message),
error = function(e) message(e$message))
}
cat("Installing package", to_install[i], "\n")
tryCatch(install.packages(to_install[i], repos = "https://cran.rstudio.com/", dependencies = TRUE, quiet = TRUE),
# message = function(m) invisible(),
warning = function(w) message(w$message),
error = function(e) message(e$message))
}
for (i in seq_len(length(to_update))) {
if (isTRUE(is.character(to_update[i]))) {
cat("Updating package", to_update[i], "\n")
tryCatch(update.packages(to_update[i], repos = "https://cran.rstudio.com/", ask = FALSE),
# message = function(m) invisible(),
warning = function(w) message(w$message),
error = function(e) message(e$message))
}
cat("Updating package", to_update[i], "\n")
tryCatch(update.packages(to_update[i], repos = "https://cran.rstudio.com/", ask = FALSE),
# message = function(m) invisible(),
warning = function(w) message(w$message),
error = function(e) message(e$message))
}

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

4
docs/articles/datasets.html

@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9049</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9050</span>
</span>
</div>
@ -192,7 +192,7 @@ @@ -192,7 +192,7 @@
<div class="page-header toc-ignore">
<h1 data-toc-skip>Data sets for download / own use</h1>
<h4 class="date">19 May 2021</h4>
<h4 class="date">20 May 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd"><code>vignettes/datasets.Rmd</code></a></small>
<div class="hidden name"><code>datasets.Rmd</code></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.9049</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9050</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.9049</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9050</span>
</span>
</div>

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

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.9049</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9050</span>
</span>
</div>
@ -236,12 +236,12 @@ @@ -236,12 +236,12 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1609049" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9049">
<a href="#amr-1609049" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9049</h1>
<div id="last-updated-19-may-2021" class="section level2">
<div id="amr-1609050" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9050">
<a href="#amr-1609050" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9050</h1>
<div id="last-updated-20-may-2021" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-19-may-2021" class="anchor"></a><small>Last updated: 19 May 2021</small>
<a href="#last-updated-20-may-2021" class="anchor"></a><small>Last updated: 20 May 2021</small>
</h2>
<div id="breaking-change" class="section level3">
<h3 class="hasAnchor">

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-19T21:58Z
last_built: 2021-05-20T08:10Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles

4
docs/reference/atc_online.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.6.0.9021</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9050</span>
</span>
</div>
@ -309,7 +309,7 @@ @@ -309,7 +309,7 @@
<li><p><code>"TU"</code> = thousand units</p></li>
<li><p><code>"MU"</code> = million units</p></li>
<li><p><code>"mmol"</code> = millimole</p></li>
<li><p><code>"ml"</code> = milliliter (e.g. eyedrops)</p></li>
<li><p><code>"ml"</code> = millilitre (e.g. eyedrops)</p></li>
</ul>
<p><strong>N.B. This function requires an internet connection and only works if the following packages are installed: <code>curl</code>, <code>rvest</code>, <code>xml2</code>.</strong></p>

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

5
inst/tinytest/test-atc_online.R

@ -23,7 +23,10 @@ @@ -23,7 +23,10 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
if (tryCatch(curl::has_internet(), error = function(e) FALSE)) {
if (pkg_is_available("curl", also_load = FALSE) &&
pkg_is_available("rvest", also_load = FALSE) &&
pkg_is_available("xml2", also_load = FALSE) &&
tryCatch(curl::has_internet(), error = function(e) FALSE)) {
expect_true(length(atc_online_groups(ab_atc("AMX"))) >= 1)
expect_equal(atc_online_ddd(ab_atc("AMX"), administration = "O"), 1.5)
expect_equal(atc_online_ddd(ab_atc("AMX"), administration = "P"), 3)

20
inst/tinytest/test-proportion.R

@ -35,17 +35,17 @@ expect_equal(proportion_R(example_isolates$AMX) + proportion_I(example_isolates$ @@ -35,17 +35,17 @@ expect_equal(proportion_R(example_isolates$AMX) + proportion_I(example_isolates$
expect_equal(proportion_S(example_isolates$AMX) + proportion_I(example_isolates$AMX),
proportion_SI(example_isolates$AMX))
expect_equal(example_isolates %>% proportion_SI(AMC),
0.7626397,
tolerance = 0.0001)
expect_equal(example_isolates %>% proportion_SI(AMC, GEN),
0.9408,
tolerance = 0.0001)
expect_equal(example_isolates %>% proportion_SI(AMC, GEN, only_all_tested = TRUE),
0.9382647,
tolerance = 0.0001)
if (pkg_is_available("dplyr")) {
expect_equal(example_isolates %>% proportion_SI(AMC),
0.7626397,
tolerance = 0.0001)
expect_equal(example_isolates %>% proportion_SI(AMC, GEN),
0.9408,
tolerance = 0.0001)
expect_equal(example_isolates %>% proportion_SI(AMC, GEN, only_all_tested = TRUE),
0.9382647,
tolerance = 0.0001)
# percentages
expect_equal(example_isolates %>%
group_by(hospital_id) %>%

2
man/atc_online.Rd

@ -61,7 +61,7 @@ Abbreviations of return values when using \code{property = "U"} (unit): @@ -61,7 +61,7 @@ Abbreviations of return values when using \code{property = "U"} (unit):
\item \code{"TU"} = thousand units
\item \code{"MU"} = million units
\item \code{"mmol"} = millimole
\item \code{"ml"} = milliliter (e.g. eyedrops)
\item \code{"ml"} = millilitre (e.g. eyedrops)
}
\strong{N.B. This function requires an internet connection and only works if the following packages are installed: \code{curl}, \code{rvest}, \code{xml2}.}

Loading…
Cancel
Save