Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_node_df

Get a node data frame from a graph


Description

From a graph, obtain a node data frame with all current node attributes.

Usage

get_node_df(graph)

Arguments

graph

A graph object of class dgr_graph.

Value

A node data frame.

Examples

# Create a graph
graph <-
  create_graph() %>%
  add_n_nodes(
    n = 1,
    type = "a") %>%
  select_last_nodes_created() %>%
  add_n_nodes_ws(
    n = 5,
    direction = "from",
    type = "b") %>%
  select_nodes_by_id(
    nodes = 1) %>%
  set_node_attrs_ws(
    node_attr = value,
    value = 25.3) %>%
  clear_selection() %>%
  select_nodes_by_id(
    nodes = 2:4) %>%
  set_node_attrs_ws(
    node_attr = color,
    value = "grey70") %>%
  invert_selection() %>%
  set_node_attrs_ws(
    node_attr = color,
    value = "grey80") %>%
  clear_selection()

# Get the graph's internal node
# data frame (ndf)
graph %>%
  get_node_df()

DiagrammeR

Graph/Network Visualization

v1.0.6.1
MIT + file LICENSE
Authors
Richard Iannone [aut, cre] (<https://orcid.org/0000-0003-3925-190X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.