mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 16:46:11 +01:00
(v1.7.1.9035) dplyr grouping fix on windows?
This commit is contained in:
parent
af23f91e5c
commit
986bd826ee
@ -1,5 +1,5 @@
|
||||
Package: AMR
|
||||
Version: 1.7.1.9033
|
||||
Version: 1.7.1.9035
|
||||
Date: 2021-08-30
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
||||
# `AMR` 1.7.1.9033
|
||||
# `AMR` 1.7.1.9035
|
||||
## <small>Last updated: 30 August 2021</small>
|
||||
|
||||
### Breaking changes
|
||||
|
@ -298,7 +298,7 @@ stop_ifnot_installed <- function(package) {
|
||||
|
||||
pkg_is_available <- function(pkg, also_load = TRUE) {
|
||||
if (also_load == TRUE) {
|
||||
out <- suppressWarnings(require(pkg, character.only = TRUE, warn.conflicts = FALSE, quietly = TRUE))
|
||||
out <- suppressWarnings(require(pkg, character.only = TRUE, warn.conflicts = FALSE))
|
||||
} else {
|
||||
out <- requireNamespace(pkg, quietly = TRUE)
|
||||
}
|
||||
@ -728,11 +728,14 @@ meet_criteria <- function(object,
|
||||
return(invisible())
|
||||
}
|
||||
|
||||
get_current_data <- function(arg_name, call) {
|
||||
get_current_data <- function(arg_name, call, requires_cur_data = FALSE) {
|
||||
# try dplyr::cur_data_all() first to support dplyr groups
|
||||
# only useful for e.g. dplyr::filter(), dplyr::mutate() and dplyr::summarise()
|
||||
# not useful (throws error) with e.g. dplyr::select() - but that will be caught later in this function
|
||||
cur_data_all <- import_fn("cur_data_all", "dplyr", error_on_fail = FALSE)
|
||||
if (isTRUE(requires_cur_data)) {
|
||||
print(cur_data_all())
|
||||
}
|
||||
if (!is.null(cur_data_all)) {
|
||||
out <- tryCatch(cur_data_all(), error = function(e) NULL)
|
||||
if (is.data.frame(out)) {
|
||||
|
@ -204,7 +204,7 @@ first_isolate <- function(x = NULL,
|
||||
if (is_null_or_grouped_tbl(x)) {
|
||||
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
|
||||
# is also fix for using a grouped df as input (a dot as first argument)
|
||||
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
|
||||
x <- tryCatch(get_current_data(arg_name = "x", call = -2, requires_cur_data = list(...)$require_cur_data), error = function(e) x)
|
||||
}
|
||||
meet_criteria(x, allow_class = "data.frame") # also checks dimensions to be >0
|
||||
meet_criteria(col_date, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
|
||||
|
Binary file not shown.
@ -44,7 +44,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.7.1.9033</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -1256,7 +1256,7 @@ If you are reading this page from within R, please <a href="https://msberends.gi
|
||||
|
||||
<footer><div class="copyright">
|
||||
<p></p>
|
||||
<p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/" class="external-link external-link">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/" class="external-link external-link">Christian F. Luz</a>, <a href="https://www.rug.nl/staff/a.w.friedrich/" class="external-link external-link">Alexander W. Friedrich</a>, <a href="https://www.rug.nl/staff/b.sinha/" class="external-link external-link">Bhanu N. M. Sinha</a>, <a href="https://www.rug.nl/staff/c.j.albers/" class="external-link external-link">Casper J. Albers</a>, <a href="https://www.rug.nl/staff/c.glasner/" class="external-link external-link">Corinna Glasner</a>.</p>
|
||||
<p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/" class="external-link external-link">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/" class="external-link external-link">Christian F. Luz</a>.</p>
|
||||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
|
@ -92,7 +92,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.7.1.9033</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9035</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -240,9 +240,9 @@
|
||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="amr-1719033" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.7.1.9033">
|
||||
<a href="#amr-1719033" class="anchor" aria-hidden="true"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9033</h1>
|
||||
<div id="amr-1719035" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.7.1.9035">
|
||||
<a href="#amr-1719035" class="anchor" aria-hidden="true"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9035</h1>
|
||||
<div id="last-updated-30-august-2021" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#last-updated-30-august-2021" class="anchor" aria-hidden="true"></a><small>Last updated: 30 August 2021</small>
|
||||
@ -2044,7 +2044,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
||||
|
||||
<footer>
|
||||
<div class="copyright">
|
||||
<p><p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/" class="external-link">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/" class="external-link">Christian F. Luz</a>, <a href="https://www.rug.nl/staff/a.w.friedrich/" class="external-link">Alexander W. Friedrich</a>, <a href="https://www.rug.nl/staff/b.sinha/" class="external-link">Bhanu N. M. Sinha</a>, <a href="https://www.rug.nl/staff/c.j.albers/" class="external-link">Casper J. Albers</a>, <a href="https://www.rug.nl/staff/c.glasner/" class="external-link">Corinna Glasner</a>.</p></p>
|
||||
<p><p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/" class="external-link">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/" class="external-link">Christian F. Luz</a>.</p></p>
|
||||
</div>
|
||||
|
||||
<div class="pkgdown">
|
||||
|
@ -133,8 +133,8 @@ if (AMR:::pkg_is_available("dplyr")) {
|
||||
first_isolate(info = TRUE))
|
||||
|
||||
# groups
|
||||
x <- example_isolates %>% group_by(ward_icu) %>% mutate(first = first_isolate())
|
||||
y <- example_isolates %>% group_by(ward_icu) %>% mutate(first = first_isolate(.))
|
||||
x <- example_isolates %>% group_by(ward_icu) %>% mutate(first = first_isolate(require_cur_data = TRUE))
|
||||
y <- example_isolates %>% group_by(ward_icu) %>% mutate(first = first_isolate(., require_cur_data = TRUE))
|
||||
expect_identical(x, y)
|
||||
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ if (identical(Sys.getenv("R_RUN_TINYTEST"), "true")) {
|
||||
"inst/tinytest",
|
||||
"tinytest"),
|
||||
verbose = 99,
|
||||
pattern = "first.*\\.[rR]$",
|
||||
color = FALSE)
|
||||
cat("SUMMARY:\n")
|
||||
print(summary(out))
|
||||
|
Loading…
Reference in New Issue
Block a user