1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 21:22:01 +02:00

filter_ab_class fix

This commit is contained in:
2019-03-06 09:32:48 +01:00
parent 74e0ae21fd
commit 5c7a061a5d
6 changed files with 137 additions and 93 deletions

View File

@ -27,8 +27,9 @@
#' @param result an antibiotic result: S, I or R (or a combination of more of them)
#' @param scope the scope to check which variables to check, can be \code{"any"} (default) or \code{"all"}
#' @param ... parameters passed on to \code{\link[dplyr]{filter_at}}
#' @details The \code{\code{antibiotics}} data set will be searched for \code{ab_class} in the columns \code{atc_group1} and \code{atc_group2} (case-insensitive). Next, \code{tbl} will be checked for column names with a value in any abbreviations, codes or official names found in the \code{antibiotics} data set.
#' @details The \code{\link{antibiotics}} data set will be searched for \code{ab_class} in the columns \code{atc_group1} and \code{atc_group2} (case-insensitive). Next, \code{tbl} will be checked for column names with a value in any abbreviations, codes or official names found in the \code{antibiotics} data set.
#' @rdname filter_ab_class
#' @keywords filter fillter_class
#' @importFrom dplyr filter_at %>% select vars any_vars all_vars
#' @importFrom crayon bold blue
#' @export
@ -89,7 +90,7 @@ filter_ab_class <- function(tbl,
scope_fn <- all_vars
}
message(blue(paste0("Filtering on ", atc_groups, ": ", scope, " of ",
paste(bold(vars_df), collapse = scope_txt), operator, toString(result))))
paste(bold(paste0("`", vars_df, "`")), collapse = scope_txt), operator, toString(result))))
tbl %>%
filter_at(.vars = vars(vars_df),
.vars_predicate = scope_fn(. %in% result),