select_last_node {DiagrammeR} | R Documentation |
Select the last node from a graph
object of class dgr_graph
. Strictly, this is
the node encompassing the last record of the graph's
node data frame. In practice, this will typically be
the last node added to the graph.
select_last_node(graph)
graph |
a graph object of class
|
a graph object of class dgr_graph
.
library(magrittr) # Create an empty graph graph <- create_graph() # Add three nodes to the graph graph %<>% add_n_nodes(3) # Select the last node added graph %<>% select_last_node # Get the current selection graph %>% get_selection #> $nodes #> [1] "3"