1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 06: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 fail-fast: false
matrix: matrix:
config: config:
# these are the developmental version of R - we allow those tests to fail # test all systems against all released versions of R >= 3.0, we support them all!
# - {os: macOS-latest, r: 'devel', allowfail: false} - {os: macOS-latest, r: 'devel', allowfail: true}
# - {os: windows-latest, r: 'devel', allowfail: false} - {os: macOS-latest, r: '4.1', allowfail: false}
# - {os: ubuntu-20.04, r: 'devel', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: macOS-latest, r: '4.0', allowfail: false}
# - {os: macOS-latest, r: '3.6', allowfail: false}
# # test all systems against all released versions of R >= 3.0, we support them all! - {os: macOS-latest, r: '3.5', allowfail: false}
# - {os: macOS-latest, r: '4.1', 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: 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: 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: 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: 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: 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: 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: 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: env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true R_REMOTES_NO_ERRORS_FROM_WARNINGS: true

View File

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

View File

@ -1,5 +1,5 @@
# `AMR` 1.7.1.9036 # `AMR` 1.7.1.9037
## <small>Last updated: 30 August 2021</small> ## <small>Last updated: 31 August 2021</small>
### Breaking changes ### Breaking changes
* Removed `p_symbol()` and all `filter_*()` functions (except for `filter_first_isolate()`), which were all deprecated in a previous package version * 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()) 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 # try dplyr::cur_data_all() first to support dplyr groups
# only useful for e.g. dplyr::filter(), dplyr::mutate() and dplyr::summarise() # 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 # 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) 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)) { if (!is.null(cur_data_all)) {
out <- tryCatch(cur_data_all(), error = function(e) NULL) out <- tryCatch(cur_data_all(), error = function(e) NULL)
if (is.data.frame(out)) { if (is.data.frame(out)) {
message("==> RETURNING cur_data_all()")
return(structure(out, type = "dplyr_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`)) { if (!is.null(env$`.data`) && is.data.frame(env$`.data`)) {
# an element `.data` will be in the environment when using `dplyr::select()` # an element `.data` will be in the environment when using `dplyr::select()`
# (but not when using `dplyr::filter()`, `dplyr::mutate()` or `dplyr::summarise()`) # (but not when using `dplyr::filter()`, `dplyr::mutate()` or `dplyr::summarise()`)
message("==> RETURNING dplyr_selector")
return(structure(env$`.data`, type = "dplyr_selector")) return(structure(env$`.data`, type = "dplyr_selector"))
} else if (!is.null(env$xx) && is.data.frame(env$xx)) { } 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()]` # 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")) return(structure(env$xx, type = "base_R"))
} else if (!is.null(env$x) && is.data.frame(env$x)) { } 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()]` # 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")) 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))) { for (i in seq_len(length(to_install))) {
cat("Installing package", to_install[i], "\n") cat("Installing package", to_install[i], "\n")
tryCatch(install.packages(to_install[i], 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/", repos = "https://cran.rstudio.com/",
dependencies = c("Depends", "Imports"), dependencies = c("Depends", "Imports"),
quiet = FALSE), quiet = FALSE),

View File

@ -44,7 +44,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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> </span>
</div> </div>
@ -190,7 +190,7 @@
<div class="page-header toc-ignore"> <div class="page-header toc-ignore">
<h1 data-toc-skip>Data sets for download / own use</h1> <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> <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> <div class="hidden name"><code>datasets.Rmd</code></div>

View File

@ -92,7 +92,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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> </span>
</div> </div>
@ -240,12 +240,12 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small> <small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div> </div>
<div id="amr-1719036" class="section level1"> <div id="amr-1719037" class="section level1">
<h1 class="page-header" data-toc-text="1.7.1.9036"> <h1 class="page-header" data-toc-text="1.7.1.9037">
<a href="#amr-1719036" class="anchor" aria-hidden="true"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9036</h1> <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-30-august-2021" class="section level2"> <div id="last-updated-31-august-2021" class="section level2">
<h2 class="hasAnchor"> <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> </h2>
<div id="breaking-changes" class="section level3"> <div id="breaking-changes" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">

View File

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