get_middle_nodes: Obtain the middle nodes of a path

Description Usage Arguments Value Examples

View source: R/utils.R

Description

For each pair of source and target nodes in object, obtain the names of middle nodes on paths.

Usage

1
get_middle_nodes(graph, object, collapse = TRUE)

Arguments

graph

The SemMed graph

object

A vertex sequence (igraph.vs), a list of vertex sequences, or a list of vertex sequence lists

collapse

If TRUE, middle node names for different source-target pairs are combined into one character vector.

Value

A tbl where each row corresponds to a source-target pair in object. The last column is a list-column containing character vectors of names of middle nodes.

Examples

1
2
3
4
5
6
data(g_mini)

node_cortisol <- find_nodes(g_mini, "Serum cortisol")
node_stress <- find_nodes(g_mini, "Chronic Stress")
paths <- find_paths(g_mini, from = node_cortisol, to = node_stress)
middle <- get_middle_nodes(g_mini, paths)

lmyint/rsemmed documentation built on July 26, 2021, 1:20 a.m.