add_n_nodes | R Documentation |
Add n
new nodes to a graph object of class dgr_graph
. Optionally, set
node type
values for the new nodes.
add_n_nodes(
graph,
n,
type = NULL,
label = NULL,
node_aes = NULL,
node_data = NULL
)
graph |
A graph object of class |
n |
The number of new nodes to add to the graph. |
type |
An optional character vector that provides group identifiers for the nodes to be added. |
label |
An optional character object that describes the nodes to be added. |
node_aes |
An optional list of named vectors comprising node aesthetic
attributes. The helper function |
node_data |
An optional list of named vectors comprising node data
attributes. The helper function |
A graph object of class dgr_graph
.
Other node creation and removal:
add_n_node_clones()
,
add_n_nodes_ws()
,
add_node()
,
add_node_clones_ws()
,
add_node_df()
,
add_nodes_from_df_cols()
,
add_nodes_from_table()
,
colorize_node_attrs()
,
copy_node_attrs()
,
create_node_df()
,
delete_node()
,
delete_nodes_ws()
,
drop_node_attrs()
,
join_node_attrs()
,
layout_nodes_w_string()
,
mutate_node_attrs()
,
mutate_node_attrs_ws()
,
node_data()
,
recode_node_attrs()
,
rename_node_attrs()
,
rescale_node_attrs()
,
set_node_attr_to_display()
,
set_node_attr_w_fcn()
,
set_node_attrs()
,
set_node_attrs_ws()
,
set_node_position()
# Create an empty graph and
# add 5 nodes; these nodes
# will be assigned ID values
# from `1` to `5`
graph <-
create_graph() %>%
add_n_nodes(n = 5)
# Get the graph's node IDs
graph %>% get_node_ids()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.