1
0
mirror of https://github.com/msberends/AMR.git synced 2026-05-14 01:10:45 +02:00

Fix candidates_formatted not found in print.mo_uncertainties()

When there is only one match (candidates field is empty), the "Also
matched:" block must be skipped. Wrapping it in if (candidates != "")
prevents the error that arose after #288 narrowed filtr to one entry.

https://claude.ai/code/session_01VH4Ju4Xq9aW1AHuoVbjGEo
This commit is contained in:
Claude
2026-05-06 18:43:00 +00:00
parent d23004641f
commit 3d3f06be24

22
R/mo.R
View File

@@ -1023,17 +1023,19 @@ print.mo_uncertainties <- function(x, n = 10, ...) {
message_(out2, as_note = FALSE) message_(out2, as_note = FALSE)
} }
other_matches <- paste0( if (x[i, ]$candidates != "") {
"Also matched: ", other_matches <- paste0(
vector_and( "Also matched: ",
paste0( vector_and(
candidates_formatted, paste0(
font_blue(paste0(" (", scores_formatted, ")"), collapse = NULL) candidates_formatted,
), font_blue(paste0(" (", scores_formatted, ")"), collapse = NULL)
quotes = FALSE, sort = FALSE ),
quotes = FALSE, sort = FALSE
)
) )
) message_(other_matches, as_note = FALSE)
message_(other_matches, as_note = FALSE) }
} }
if (isTRUE(any_maxed_out)) { if (isTRUE(any_maxed_out)) {