From 8d294f2c22c79f57a90d2132c597ffe68b4f6c63 Mon Sep 17 00:00:00 2001 From: "Marvin N. Wright" Date: Thu, 13 Jun 2024 08:11:16 +0200 Subject: [PATCH] nomatch force for the no macthing leaf case --- R/utils.R | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index a4e00b5..be14f29 100644 --- a/R/utils.R +++ b/R/utils.R @@ -436,7 +436,15 @@ cforde <- function(params, } } conds_impossible <- conds_conditioned[!(conds_conditioned %in% relevant_leaves[,unique(c_idx)])] - relevant_leaves <- setorder(rbind(relevant_leaves, data.table(c_idx = conds_impossible, f_idx = NA_integer_, f_idx_uncond = NA_integer_))) + + if (grepl("^force", nomatch)) { + # All leaves + impossible_leaves <- data.table(c_idx = conds_impossible, f_idx = forest$f_idx, f_idx_uncond = forest$f_idx) + } else { + # Set to NA -> no leaves -> Sample NA + impossible_leaves <- data.table(c_idx = conds_impossible, f_idx = NA_integer_, f_idx_uncond = NA_integer_) + } + relevant_leaves <- setorder(rbind(relevant_leaves, impossible_leaves)) } }