Learn R Programming

mcmodule (version 1.2.0)

which_mcnode: Find mcnodes Matching a Condition

Description

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)

Value

Character vector of mcnode names where test_func returns TRUE. Empty vector if no nodes meet the condition.

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.

See Also

which_mcnode_na(), which_mcnode_inf()

Examples

Run this code
# Find nodes with negative values
which_mcnode(imports_mcmodule, function(x) any(x < 0, na.rm = TRUE))

# Find nodes with values greater than 1
which_mcnode(imports_mcmodule, function(x) any(x > 1, na.rm = TRUE))

Run the code above in your browser using DataLab