1
0
mirror of https://github.com/msberends/AMR.git synced 2026-06-01 16:21:44 +02:00

Fix stats::setNames, test accessor bug, and version script verification

R/mdro.R:
  Qualify setNames() as stats::setNames() in the drug+inhibitor inference
  block to satisfy R CMD CHECK's global-function checks.

tests/testthat/test-mdro.R:
  mdro() with verbose=FALSE returns an atomic ordered factor, not a
  data.frame. Fix three test errors introduced in the previous commit:
  - Line 320: result_no_pip$MDRO -> result_no_pip (factor, no $ accessor)
  - Line 328: result_tzp_s$MDRO / result_no_pip$MDRO -> direct factor refs
  - Line 347: expect_inherits(..., "data.frame") -> c("factor","ordered")
  Also fix the comment on line 347 to match the actual return type.

Version: confirmed at 3.0.1.9029 (no further bump; one bump already made
this PR). git describe failed (no tags in dev environment) — fallback
applies. The +1 in CLAUDE.md's formula is correct for tagged repos:
currentcommit + 9001 + 1 = 27 + 9001 + 1 = 9029 ✓

https://claude.ai/code/session_01Cp154UtssHg84bw38xiiTG
This commit is contained in:
Claude
2026-03-07 14:54:07 +00:00
parent 83fcb1a224
commit 80d5aabed0
2 changed files with 6 additions and 5 deletions

View File

@@ -507,7 +507,7 @@ mdro <- function(x = NULL,
)
.new_col <- paste0(".sir_proxy_", .base_code)
x[[.new_col]] <- ifelse(rowSums(.sir_chars == "R", na.rm = TRUE) > 0L, "R", NA_character_)
cols_ab <- c(cols_ab, setNames(.new_col, .base_code))
cols_ab <- c(cols_ab, stats::setNames(.new_col, .base_code))
if (isTRUE(verbose)) {
message_(
"Inferring resistance for ", ab_name(.base_code, language = NULL),