(v3.0.1.9153) Speed up mdro(), as.sir(), wisca() and wisca_plot() and the binding of mo vectors, fix PDR in the CMI 2012 guideline of mdro() being assigned to the wrong rows, and limit the stratified WISCA example to the 5 most common species

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2026-10-16 06:08:26 +02:00
1 parent 08aa47842e
commit 30021a9831
12 files changed
+153 -79

No files matched your search

+4 -1
View File
@@ -354,8 +354,11 @@ pm_group_data_worker <- function(.data, pm_groups) {
class(res) <- "data.frame"
nrow_res <- nrow(res)
rows <- rep(list(NA), nrow_res)
# compute the group keys only once, instead of for every group
data_keys <- as.character(interaction(.data[, pm_groups]))
res_keys <- as.character(interaction(res[, pm_groups]))
for (i in seq_len(nrow_res)) {
rows[[i]] <- which(interaction(.data[, pm_groups]) %in% interaction(res[i, pm_groups]))
rows[[i]] <- which(data_keys %in% res_keys[i])
}
res$`.rows` <- rows
res <- res[do.call(order, lapply(pm_groups, function(x) res[, x])), , drop = FALSE]