refactor(notes): simplify aggregate-fallback predicate in .notes_column
The plan-supplied predicate combined three redundant checks (is.null + any + %in% TRUE). Element-wise behavior was correct via scalar recycling, but the form was confusing — a code-quality reviewer misread it as a multi-row false-positive bug. Simplify to mirror the parts[[2]] structure: gate on column presence, then element-wise %in% TRUE check. Equivalent semantics, fewer ways to misread.
This commit is contained in:
+7
-5
@@ -189,11 +189,13 @@ cog_spending <- function(govid, years, category = NULL,
|
||||
if (n == 0L) return(character(0))
|
||||
parts <- vector("list", 2L)
|
||||
agg <- result[["aggregate_fallback"]]
|
||||
parts[[1]] <- ifelse(
|
||||
!is.null(agg) & isTRUE(any(agg, na.rm = TRUE)) & agg %in% TRUE,
|
||||
"Aggregate fallback applied; see cog_explain()",
|
||||
NA_character_
|
||||
)
|
||||
parts[[1]] <- if (!is.null(agg)) {
|
||||
ifelse(agg %in% TRUE,
|
||||
"Aggregate fallback applied; see cog_explain()",
|
||||
NA_character_)
|
||||
} else {
|
||||
rep(NA_character_, n)
|
||||
}
|
||||
ps <- result[["pop_source"]]
|
||||
parts[[2]] <- if (!is.null(ps)) {
|
||||
ifelse(ps == "unavailable",
|
||||
|
||||
Reference in New Issue
Block a user