fix for group selections

This commit is contained in:
dr. M.S. (Matthijs) Berends 2023-02-15 17:37:49 +01:00
parent ef716f6ee3
commit a82552dd88
3 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,5 @@
Package: AMR
Version: 1.8.2.9129
Version: 1.8.2.9130
Date: 2023-02-15
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)

View File

@ -1,4 +1,4 @@
# AMR 1.8.2.9129
# AMR 1.8.2.9130
*(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)*

View File

@ -900,12 +900,14 @@ get_current_data <- function(arg_name, call) {
# e.g. for `example_isolates %>% group_by(ward) %>% mutate(first = first_isolate(.))`
if (valid_df(env$data)) {
# support for dplyr 1.1.x
return(env$data[env$mask$current_rows(), , drop = FALSE])
df <- env$data
} else {
# support for dplyr 1.0.x
return(env$`.data`[env$mask$current_rows(), , drop = FALSE])
df <- env$`.data`
}
rows <- tryCatch(env$mask$current_rows(), error = function(e) seq_len(NROW(df)))
return(df[rows, , drop = FALSE])
# base R support ----
} else if (!is.null(env$`.Generic`)) {
# don't check `".Generic" %in% names(env)`, because in R < 3.2, `names(env)` is always NULL