get_node_index: Get the node indices from a tidygraph

Description Usage Arguments Examples

View source: R/get_node_index.R

Description

Some functions in the 'tidygraph' package require the index of a node. This function evalutes an input expression in the dplyr::filter() function in the node tibble of a tidygraph object and returns the indices of the nodes that pass.

Usage

1
get_node_index(gr, expr)

Arguments

gr

a tidygraph

expr

an expression to be quoted and evaluated in the context of the node tibble of the tidygraph object

Examples

1
2
3
get_node_index(quick_barabasi(10), name == "B")
get_node_index(quick_barabasi(10), name %in% c("B", "C", "D"))
get_node_index(quick_barabasi(10), stringr::str_detect(name, "A|B|C"))

jhrcook/jhcutils documentation built on Sept. 2, 2020, 7:16 a.m.