DiagrammeR (version 0.9.2)

drop_node_attrs: Drop a node attribute column

Description

Within a graph's internal ndf, remove an existing node attribute.

Usage

drop_node_attrs(graph, node_attr)

Arguments

graph

a graph object of class dgr_graph.

node_attr

the name of the node attribute column to drop.

Value

a graph object of class dgr_graph.

Examples

Run this code
# NOT RUN {
# Create a random graph
graph <-
  create_random_graph(
    n = 5, m = 10,
    set_seed = 23)

# Get the graph's internal ndf to show
# which node attributes are available
get_node_df(graph)
#>   id type label value
#> 1  1 <NA>     1   6.0
#> 2  2 <NA>     2   2.5
#> 3  3 <NA>     3   3.5
#> 4  4 <NA>     4   7.5
#> 5  5 <NA>     5   8.5

# Drop the `value` node attribute
graph <-
  graph %>%
  drop_node_attrs(
    node_attr = value)

# Get the graph's internal ndf to show that
# the node attribute `value` had been removed
get_node_df(graph)
#>   id type label
#> 1  1 <NA>     1
#> 2  2 <NA>     2
#> 3  3 <NA>     3
#> 4  4 <NA>     4
#> 5  5 <NA>     5
# }

Run the code above in your browser using DataCamp Workspace