1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 18:46:11 +01:00

(v1.0.0.9005) info printing only in interactive mode

This commit is contained in:
dr. M.S. (Matthijs) Berends 2020-02-21 21:13:38 +01:00
parent 47fe8b7820
commit ea32e9916a
28 changed files with 52 additions and 36 deletions

View File

@ -1,5 +1,5 @@
Package: AMR
Version: 1.0.0.9004
Version: 1.0.0.9005
Date: 2020-02-21
Title: Antimicrobial Resistance Analysis
Authors@R: c(

View File

@ -1,4 +1,4 @@
# AMR 1.0.0.9004
# AMR 1.0.0.9005
## <small>Last updated: 21-Feb-2020</small>
### Changed
@ -13,6 +13,7 @@
```
* Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole
* Added `uti` (as abbreviation of urinary tract infections) as parameter to `as.rsi()`, so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs
* Info printing in functions `eucast_rules()`, `first_isolate()`, `mdro()` and `resistance_predict()` will now at default only print when R is in an interactive mode (i.e. not in RMarkdown)
# AMR 1.0.0

View File

@ -197,7 +197,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
#' }
eucast_rules <- function(x,
col_mo = NULL,
info = TRUE,
info = interactive(),
rules = c("breakpoints", "expert", "other", "all"),
verbose = FALSE,
...) {

View File

@ -148,7 +148,7 @@ first_isolate <- function(x,
type = "keyantibiotics",
ignore_I = TRUE,
points_threshold = 2,
info = TRUE,
info = interactive(),
include_unknown = FALSE,
...) {

View File

@ -84,7 +84,7 @@
mdro <- function(x,
guideline = "CMI2012",
col_mo = NULL,
info = TRUE,
info = interactive(),
pct_required_classes = 0.5,
combine_SI = TRUE,
verbose = FALSE,

View File

@ -125,6 +125,7 @@ search_type_in_df <- function(x, type) {
found <- colnames(x)[colnames(x) %like% "(urine|urinary)"][1]
}
if (!is.null(found)) {
# this column should contain logicals
if (!is.logical(x[, found, drop = TRUE])) {
message(red(paste0("NOTE: Column `", bold(found), "` found as input for `col_", type,
"`, but this column does not contain 'logical' values (TRUE/FALSE) and was ignored.")))

View File

@ -121,7 +121,7 @@ resistance_predict <- function(x,
model = NULL,
I_as_S = TRUE,
preserve_measurements = TRUE,
info = TRUE,
info = interactive(),
...) {
if (nrow(x) == 0) {

View File

@ -135,6 +135,7 @@ reference:
- "`antibiotics`"
- "`antivirals`"
- "`example_isolates`"
- "`example_isolates_unclean`"
- "`microorganisms.codes`"
- "`microorganisms.old`"
- "`microorganisms`"

View File

@ -78,7 +78,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.0.0.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>

View File

@ -78,7 +78,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.0.0.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>

View File

@ -78,7 +78,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.0.0.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>

View File

@ -78,7 +78,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.0.0.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>

View File

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

View File

@ -78,7 +78,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.0.0.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>
@ -219,9 +219,9 @@
</div>
<div id="amr-1009004" class="section level1">
<div id="amr-1009005" class="section level1">
<h1 class="page-header">
<a href="#amr-1009004" class="anchor"></a>AMR 1.0.0.9004<small> Unreleased </small>
<a href="#amr-1009005" class="anchor"></a>AMR 1.0.0.9005<small> Unreleased </small>
</h1>
<div id="last-updated-21-feb-2020" class="section level2">
<h2 class="hasAnchor">
@ -242,6 +242,7 @@
</li>
<li><p>Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole</p></li>
<li><p>Added <code>uti</code> (as abbreviation of urinary tract infections) as parameter to <code><a href="../reference/as.rsi.html">as.rsi()</a></code>, so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs</p></li>
<li><p>Info printing in functions <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>, <code><a href="../reference/first_isolate.html">first_isolate()</a></code>, <code><a href="../reference/mdro.html">mdro()</a></code> and <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code> will now at default only print when R is in an interactive mode (i.e. not in RMarkdown)</p></li>
</ul>
</div>
</div>
@ -1473,7 +1474,7 @@
<div id="tocnav">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#amr-1009004">1.0.0.9004</a></li>
<li><a href="#amr-1009005">1.0.0.9005</a></li>
<li><a href="#amr-100">1.0.0</a></li>
<li><a href="#amr-090">0.9.0</a></li>
<li><a href="#amr-080">0.8.0</a></li>

View File

@ -79,7 +79,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.0.0.9003</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>

View File

@ -80,7 +80,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
</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">0.9.0.9029</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>
@ -230,7 +230,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
<pre class="usage"><span class='fu'>eucast_rules</span>(
<span class='no'>x</span>,
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/interactive.html'>interactive</a></span>(),
<span class='kw'>rules</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"breakpoints"</span>, <span class='st'>"expert"</span>, <span class='st'>"other"</span>, <span class='st'>"all"</span>),
<span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
<span class='no'>...</span>

View File

@ -79,7 +79,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.0.0.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>

View File

@ -79,7 +79,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">0.9.0.9029</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>
@ -241,7 +241,7 @@
<span class='kw'>type</span> <span class='kw'>=</span> <span class='st'>"keyantibiotics"</span>,
<span class='kw'>ignore_I</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>points_threshold</span> <span class='kw'>=</span> <span class='fl'>2</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/interactive.html'>interactive</a></span>(),
<span class='kw'>include_unknown</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
<span class='no'>...</span>
)

View File

@ -78,7 +78,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.0.0.9004</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>
@ -451,6 +451,12 @@
<td><p>Data set with 2,000 example isolates</p></td>
</tr><tr>
<td>
<p><code><a href="example_isolates_unclean.html">example_isolates_unclean</a></code> </p>
</td>
<td><p>Data set with unclean data</p></td>
</tr><tr>
<td>
<p><code><a href="microorganisms.codes.html">microorganisms.codes</a></code> </p>
</td>

View File

@ -79,7 +79,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">0.9.0.9029</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>
@ -229,7 +229,7 @@
<span class='no'>x</span>,
<span class='kw'>guideline</span> <span class='kw'>=</span> <span class='st'>"CMI2012"</span>,
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/interactive.html'>interactive</a></span>(),
<span class='kw'>pct_required_classes</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
<span class='kw'>combine_SI</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,

View File

@ -79,7 +79,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">0.9.0.9029</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9005</span>
</span>
</div>
@ -236,7 +236,7 @@
<span class='kw'>model</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>I_as_S</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>preserve_measurements</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/interactive.html'>interactive</a></span>(),
<span class='no'>...</span>
)
@ -251,7 +251,7 @@
<span class='kw'>model</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>I_as_S</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>preserve_measurements</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/interactive.html'>interactive</a></span>(),
<span class='no'>...</span>
)

View File

@ -19,7 +19,7 @@ Leclercq et al. \strong{EUCAST expert rules in antimicrobial susceptibility test
eucast_rules(
x,
col_mo = NULL,
info = TRUE,
info = interactive(),
rules = c("breakpoints", "expert", "other", "all"),
verbose = FALSE,
...

View File

@ -27,7 +27,7 @@ first_isolate(
type = "keyantibiotics",
ignore_I = TRUE,
points_threshold = 2,
info = TRUE,
info = interactive(),
include_unknown = FALSE,
...
)

View File

@ -22,7 +22,7 @@ mdro(
x,
guideline = "CMI2012",
col_mo = NULL,
info = TRUE,
info = interactive(),
pct_required_classes = 0.5,
combine_SI = TRUE,
verbose = FALSE,

View File

@ -18,7 +18,7 @@ resistance_predict(
model = NULL,
I_as_S = TRUE,
preserve_measurements = TRUE,
info = TRUE,
info = interactive(),
...
)
@ -33,7 +33,7 @@ rsi_predict(
model = NULL,
I_as_S = TRUE,
preserve_measurements = TRUE,
info = TRUE,
info = interactive(),
...
)

View File

@ -31,5 +31,9 @@ test_that("disk works", {
expect_silent(as.disk(levels(as.disk(15))))
expect_warning(as.disk("INVALID VALUE"))
expect_output(print(as.disk(12)))
library(tibble)
expect_output(print(tibble(d = as.disk(12))))
})

View File

@ -110,9 +110,9 @@ test_that("EUCAST rules work", {
"S")
# also test norf
expect_output(suppressWarnings(eucast_rules(example_isolates %>% mutate(NOR = "S", NAL = "S"))))
expect_output(suppressWarnings(eucast_rules(example_isolates %>% mutate(NOR = "S", NAL = "S"), info = TRUE)))
# check verbose output
expect_output(suppressWarnings(eucast_rules(example_isolates, verbose = TRUE)))
expect_output(suppressWarnings(eucast_rules(example_isolates, verbose = TRUE, info = TRUE)))
})

View File

@ -141,7 +141,8 @@ test_that("first isolates work", {
mutate(first = first_isolate(., "date", "patient_id",
col_mo = "mo",
col_specimen = "specimen",
filter_specimen = "something_unexisting")))
filter_specimen = "something_unexisting",
info = TRUE)))
# printing of exclusion message
expect_message(example_isolates %>%
@ -149,7 +150,8 @@ test_that("first isolates work", {
col_mo = "mo",
col_patient_id = "patient_id",
col_testcode = "gender",
testcodes_exclude = "M"))
testcodes_exclude = "M",
info = TRUE))
# errors
expect_error(first_isolate("date", "patient_id", col_mo = "mo"))