diff --git a/NEWS.md b/NEWS.md index 3262d65ab..b8c7a5ecb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -38,6 +38,7 @@ * Fixed `as.sir()` for data frames silently deleting columns whose AB class was already `` when called a second time (re-running on already-converted data) (#278) * Fixed `as.sir()` for data frames incorrectly treating metadata columns (e.g. `patient`, `ward`) as antibiotic columns when their names coincidentally matched an antibiotic code; column content is now validated against AMR data patterns before inclusion * Improved parallel computing in `as.sir()`: when the number of AB columns is smaller than the number of available cores, rows are now split into batches so all cores stay active (row-batch mode). Previously, a 6-column dataset on a 16-core machine would only use 6 cores; now all 16 are used, with each worker processing a smaller row slice (lower per-worker memory pressure) +* Fixed `as.sir()` ignoring `info = FALSE` for columns with no breakpoints (e.g. cefoxitin against *E. coli*): an operator-precedence bug (`&&`/`||`) caused the "Interpreting MIC values" intro message to fire unconditionally when `nrow(breakpoints) == 0`, regardless of `info`; the progress bar title was also not gated by `info` ### Updates * Extensive `cli` integration for better message handling and clickable links in messages and warnings (#191, #265) diff --git a/R/sir.R b/R/sir.R index 024ab34e4..5c6ddb3a2 100755 --- a/R/sir.R +++ b/R/sir.R @@ -1598,11 +1598,11 @@ as_sir_method <- function(method_short, add_intrinsic_resistance_to_AMR_env() } - if (isTRUE(info) && nrow(df_unique) < 10 || nrow(breakpoints) == 0) { + if (isTRUE(info) && (nrow(df_unique) < 10 || nrow(breakpoints) == 0)) { # only print intro under 10 items, otherwise progressbar will print this and then it will be printed double message_(intro_txt, appendLF = FALSE, as_note = FALSE) } - p <- progress_ticker(n = nrow(df_unique), n_min = 10, title = intro_txt, only_bar_percent = TRUE) + p <- progress_ticker(n = nrow(df_unique), n_min = 10, print = isTRUE(info), title = intro_txt, only_bar_percent = TRUE) has_progress_bar <- !is.null(import_fn("progress_bar", "progress", error_on_fail = FALSE)) && nrow(df_unique) >= 10 on.exit(close(p))