View source: R/get_FSdata_helpers.R
| evaluate_cuts_once | R Documentation |
Evaluates all cut expressions once and caches results to avoid redundant evaluation. Much faster than evaluating repeatedly.
evaluate_cuts_once(confs, df, details = FALSE)
confs |
Character vector of cut expressions. |
df |
Data frame to evaluate expressions against. |
details |
Logical. Print details during execution. |
This replaces multiple eval(parse()) calls scattered throughout get_FSdata. By caching results, we avoid:
Repeated parsing of expressions
Repeated evaluation on dataframe
Redundant uniqueness checks
List with:
evaluations: List of evaluated vectors (logical TRUE/FALSE) for each cut
is_valid: Logical vector indicating which cuts produced >1 unique value
has_error: Logical vector indicating which cuts failed to evaluate
df <- data.frame(age = c(40, 55, 70), size = c(20, 30, 25))
confs <- c("age <= 50", "size > 25")
evaluate_cuts_once(confs, df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.