Applies a test function to each mcnode in an mcmodule and returns the
names of nodes where the test returns TRUE. Useful for identifying nodes
with specific properties (e.g., NA values, negative values).
Usage
which_mcnode(mcmodule, test_func)
Arguments
- mcmodule
(mcmodule object). Module containing node_list with mcnodes.
- test_func
(function). Function that takes an mcnode and returns logical;
TRUE if the condition is met.
Value
Character vector of mcnode names where test_func returns TRUE.
Empty vector if no nodes meet the condition.
Examples
# Find nodes with negative values
which_mcnode(imports_mcmodule, function(x) any(x < 0, na.rm = TRUE))
#> character(0)
# Find nodes with values greater than 1
which_mcnode(imports_mcmodule, function(x) any(x > 1, na.rm = TRUE))
#> character(0)