If the node attribute exists, TRUE
is returned
silently; otherwise the function throws an informative error.
check_gr(gr, node_attr)
gr | a tidygraph graph object |
---|---|
node_attr | name of node attribute to check for |
(silently) TRUE or throws an error with the message: "<node_attr> not a node attribute in the graph"
gr <- tidygraph::create_ring(5) gr <- tidygraph::mutate(gr, new_attr = LETTERS[1:5]) check_result <- check_gr(gr, "new_attr") print(check_result)#> [1] TRUE