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

(v1.7.1.9037) dplyr grouping fix on windows?

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-08-31 17:06:44 +02:00
parent 953dfac9e5
commit bcab74fb6d
9 changed files with 38 additions and 49 deletions

View File

@ -52,35 +52,33 @@ jobs:
fail-fast: false
matrix:
config:
# these are the developmental version of R - we allow those tests to fail
# - {os: macOS-latest, r: 'devel', allowfail: false}
# - {os: windows-latest, r: 'devel', allowfail: false}
# - {os: ubuntu-20.04, r: 'devel', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
#
# # test all systems against all released versions of R >= 3.0, we support them all!
# - {os: macOS-latest, r: '4.1', allowfail: false}
# test all systems against all released versions of R >= 3.0, we support them all!
- {os: macOS-latest, r: 'devel', allowfail: true}
- {os: macOS-latest, r: '4.1', allowfail: false}
- {os: macOS-latest, r: '4.0', allowfail: false}
- {os: macOS-latest, r: '3.6', allowfail: false}
- {os: macOS-latest, r: '3.5', allowfail: false}
- {os: macOS-latest, r: '3.4', allowfail: false}
- {os: macOS-latest, r: '3.3', allowfail: false}
- {os: macOS-latest, r: '3.2', allowfail: false}
- {os: ubuntu-20.04, r: 'devel', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '4.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '4.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '3.6', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '3.5', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '3.3', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '3.2', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '3.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '3.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: windows-latest, r: 'devel', allowfail: true}
- {os: windows-latest, r: '4.1', allowfail: false}
# - {os: ubuntu-20.04, r: '4.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# - {os: macOS-latest, r: '4.0', allowfail: false}
- {os: windows-latest, r: '4.0', allowfail: false}
# - {os: ubuntu-20.04, r: '4.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# - {os: macOS-latest, r: '3.6', allowfail: false}
- {os: windows-latest, r: '3.6', allowfail: false}
# - {os: ubuntu-20.04, r: '3.6', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# - {os: macOS-latest, r: '3.5', allowfail: false}
- {os: windows-latest, r: '3.5', allowfail: false}
# - {os: ubuntu-20.04, r: '3.5', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# - {os: macOS-latest, r: '3.4', allowfail: false}
- {os: windows-latest, r: '3.4', allowfail: false}
# - {os: ubuntu-20.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# - {os: macOS-latest, r: '3.3', allowfail: false}
- {os: windows-latest, r: '3.3', allowfail: false}
# - {os: ubuntu-20.04, r: '3.3', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# - {os: macOS-latest, r: '3.2', allowfail: false}
- {os: windows-latest, r: '3.2', allowfail: false}
# - {os: ubuntu-20.04, r: '3.2', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# - {os: ubuntu-20.04, r: '3.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# - {os: ubuntu-20.04, r: '3.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 1.7.1.9036
Date: 2021-08-30
Version: 1.7.1.9037
Date: 2021-08-31
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by

View File

@ -1,5 +1,5 @@
# `AMR` 1.7.1.9036
## <small>Last updated: 30 August 2021</small>
# `AMR` 1.7.1.9037
## <small>Last updated: 31 August 2021</small>
### Breaking changes
* Removed `p_symbol()` and all `filter_*()` functions (except for `filter_first_isolate()`), which were all deprecated in a previous package version

View File

@ -728,18 +728,14 @@ meet_criteria <- function(object,
return(invisible())
}
get_current_data <- function(arg_name, call, requires_cur_data = FALSE) {
get_current_data <- function(arg_name, call) {
# 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)) {
message("==> RETURNING cur_data_all()")
return(structure(out, type = "dplyr_cur_data_all"))
}
}
@ -752,17 +748,14 @@ get_current_data <- function(arg_name, call, requires_cur_data = FALSE) {
if (!is.null(env$`.data`) && is.data.frame(env$`.data`)) {
# an element `.data` will be in the environment when using `dplyr::select()`
# (but not when using `dplyr::filter()`, `dplyr::mutate()` or `dplyr::summarise()`)
message("==> RETURNING dplyr_selector")
return(structure(env$`.data`, type = "dplyr_selector"))
} else if (!is.null(env$xx) && is.data.frame(env$xx)) {
# an element `xx` will be in the environment for rows + cols, e.g. `example_isolates[c(1:3), carbapenems()]`
message("==> RETURNING base_R 1")
return(structure(env$xx, type = "base_R"))
} else if (!is.null(env$x) && is.data.frame(env$x)) {
# an element `x` will be in the environment for only cols, e.g. `example_isolates[, carbapenems()]`
message("==> RETURNING base_R 2")
return(structure(env$x, type = "base_R"))
}
}

Binary file not shown.

View File

@ -40,7 +40,7 @@ if (length(to_install) == 0) {
for (i in seq_len(length(to_install))) {
cat("Installing package", to_install[i], "\n")
tryCatch(install.packages(to_install[i],
type = ifelse(.Platform$OS.type == "unix", "source", "binary"),
# type = ifelse(.Platform$OS.type == "unix", "source", "binary"),
repos = "https://cran.rstudio.com/",
dependencies = c("Depends", "Imports"),
quiet = FALSE),

View File

@ -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.9036</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9037</span>
</span>
</div>
@ -190,7 +190,7 @@
<div class="page-header toc-ignore">
<h1 data-toc-skip>Data sets for download / own use</h1>
<h4 data-toc-skip class="date">30 August 2021</h4>
<h4 data-toc-skip class="date">31 August 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/datasets.Rmd" class="external-link"><code>vignettes/datasets.Rmd</code></a></small>
<div class="hidden name"><code>datasets.Rmd</code></div>

View File

@ -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.9036</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9037</span>
</span>
</div>
@ -240,12 +240,12 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1719036" class="section level1">
<h1 class="page-header" data-toc-text="1.7.1.9036">
<a href="#amr-1719036" class="anchor" aria-hidden="true"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9036</h1>
<div id="last-updated-30-august-2021" class="section level2">
<div id="amr-1719037" class="section level1">
<h1 class="page-header" data-toc-text="1.7.1.9037">
<a href="#amr-1719037" class="anchor" aria-hidden="true"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9037</h1>
<div id="last-updated-31-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>
<a href="#last-updated-31-august-2021" class="anchor" aria-hidden="true"></a><small>Last updated: 31 August 2021</small>
</h2>
<div id="breaking-changes" class="section level3">
<h3 class="hasAnchor">

View File

@ -117,14 +117,12 @@ if (AMR:::pkg_is_available("dplyr")) {
first_isolate(col_date = "date",
col_mo = "mo",
col_patient_id = "patient_id",
info = FALSE,
require_cur_data = TRUE),
info = FALSE),
example_isolates %>%
first_isolate(col_date = "date",
col_mo = "mo",
col_patient_id = "patient_id",
info = FALSE,
require_cur_data = TRUE))
info = FALSE))
# support for WHONET
expect_message(example_isolates %>%
@ -135,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(require_cur_data = TRUE))
y <- example_isolates %>% group_by(ward_icu) %>% mutate(first = first_isolate(., require_cur_data = TRUE))
x <- example_isolates %>% group_by(ward_icu) %>% mutate(first = first_isolate())
y <- example_isolates %>% group_by(ward_icu) %>% mutate(first = first_isolate(.))
expect_identical(x, y)
}