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

(v1.6.0.9020) fix for skimr in dplyr 1.0.6

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-05-06 15:17:11 +02:00
parent 5899678b74
commit 3319fbae58
17 changed files with 29 additions and 39 deletions

View File

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

View File

@ -1,5 +1,5 @@
# `AMR` 1.6.0.9019
## <small>Last updated: 5 May 2021</small>
# `AMR` 1.6.0.9020
## <small>Last updated: 6 May 2021</small>
### New
* Function `custom_eucast_rules()` that brings support for custom AMR rules in `eucast_rules()`
@ -36,6 +36,7 @@
* Colour fix for using `barplot()` on an RSI class
* Added 25 common system codes for bacteria to the `microorganisms.codes` data set
* Added 16 common system codes for antimicrobial agents to the `antibiotics` data set
* Fix for using `skimr::skim()` on classes `mo`, `mic` and `disk` when using the just released `dplyr` v1.0.6
# `AMR` 1.6.0

View File

@ -202,7 +202,7 @@ get_skimmers.disk <- function(column) {
min = ~min(as.double(.), na.rm = TRUE),
max = ~max(as.double(.), na.rm = TRUE),
median = ~stats::median(as.double(.), na.rm = TRUE),
n_unique = ~pm_n_distinct(., na.rm = TRUE),
n_unique = ~length(unique(stats::na.omit(.))),
hist = ~skimr::inline_hist(stats::na.omit(as.double(.)))
)
}

View File

@ -348,7 +348,7 @@ get_skimmers.mic <- function(column) {
min = ~min(., na.rm = TRUE),
max = ~max(., na.rm = TRUE),
median = ~stats::median(., na.rm = TRUE),
n_unique = ~pm_n_distinct(., na.rm = TRUE),
n_unique = ~length(unique(stats::na.omit(.))),
hist_log2 = ~skimr::inline_hist(log2(stats::na.omit(.)))
)
}

6
R/mo.R
View File

@ -1732,9 +1732,9 @@ freq.mo <- function(x, ...) {
get_skimmers.mo <- function(column) {
skimr::sfl(
skim_type = "mo",
unique_total = ~pm_n_distinct(., na.rm = TRUE),
gram_negative = ~sum(mo_is_gram_negative(stats::na.omit(.))),
gram_positive = ~sum(mo_is_gram_positive(stats::na.omit(.))),
unique_total = ~length(unique(stats::na.omit(.))),
gram_negative = ~sum(mo_is_gram_negative(.), na.rm = TRUE),
gram_positive = ~sum(mo_is_gram_positive(.), na.rm = TRUE),
top_genus = ~names(sort(-table(mo_genus(stats::na.omit(.), language = NULL))))[1L],
top_species = ~names(sort(-table(mo_name(stats::na.omit(.), language = NULL))))[1L]
)

20
R/rsi.R
View File

@ -934,28 +934,16 @@ get_skimmers.rsi <- function(column) {
# get the variable name 'skim_variable'
name_call <- function(.data) {
calls <- sys.calls()
frms <- sys.frames()
calls_txt <- vapply(calls, function(x) paste(deparse(x), collapse = ""), FUN.VALUE = character(1))
if (any(calls_txt %like% "skim_variable", na.rm = TRUE)) {
ind <- which(calls_txt %like% "skim_variable")[1L]
vars <- tryCatch(eval(parse(text = ".data$skim_variable"), envir = sys.frame(ind)),
vars <- tryCatch(eval(parse(text = ".data$skim_variable$rsi"), envir = frms[[ind]]),
error = function(e) NULL)
tryCatch(ab_name(as.character(calls[[length(calls)]][[2]]), language = NULL),
error = function(e) NA_character_)
} else {
vars <- NULL
}
i <- tryCatch(attributes(calls[[length(calls)]])$position,
error = function(e) NULL)
if (is.null(vars) | is.null(i)) {
NA_character_
} else {
lengths <- vapply(FUN.VALUE = double(1), vars, length)
when_starts_rsi <- which(names(vapply(FUN.VALUE = double(1), vars, length)) == "rsi")
offset <- sum(lengths[c(1:when_starts_rsi - 1)])
var <- vars$rsi[i - offset]
if (!isFALSE(var == "data")) {
NA_character_
} else{
ab_name(var)
}
}
}

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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.9019</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.6.0.9020</span>
</span>
</div>
@ -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-1609019" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9019">
<a href="#amr-1609019" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9019</h1>
<div id="last-updated-5-may-2021" class="section level2">
<div id="amr-1609020" class="section level1">
<h1 class="page-header" data-toc-text="1.6.0.9020">
<a href="#amr-1609020" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.6.0.9020</h1>
<div id="last-updated-6-may-2021" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-5-may-2021" class="anchor"></a><small>Last updated: 5 May 2021</small>
<a href="#last-updated-6-may-2021" class="anchor"></a><small>Last updated: 6 May 2021</small>
</h2>
<div id="new" class="section level3">
<h3 class="hasAnchor">
@ -300,6 +300,7 @@
<li>Colour fix for using <code><a href="https://rdrr.io/r/graphics/barplot.html">barplot()</a></code> on an RSI class</li>
<li>Added 25 common system codes for bacteria to the <code>microorganisms.codes</code> data set</li>
<li>Added 16 common system codes for antimicrobial agents to the <code>antibiotics</code> data set</li>
<li>Fix for using <code><a href="https://docs.ropensci.org/skimr/reference/skim.html">skimr::skim()</a></code> on classes <code>mo</code>, <code>mic</code> and <code>disk</code> when using the just released <code>dplyr</code> v1.0.6</li>
</ul>
</div>
</div>

View File

@ -12,7 +12,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
last_built: 2021-05-05T13:26Z
last_built: 2021-05-06T13:16Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles

View File

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

View File

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