add_nodes_from_df {DiagrammeR}R Documentation

Add nodes and attributes from a data frame

Description

Add nodes and their attributes to an existing graph object from data in a data frame.

Usage

add_nodes_from_df(graph, df, set_type = NULL, select_cols = NULL,
  drop_cols = NULL, rename_attrs = NULL, id_col = NULL, type_col = NULL,
  label_col = NULL)

Arguments

graph

a graph object of class dgr_graph that is created using create_graph.

df

the name of the data frame object.

set_type

an optional string to apply a type attribute to all nodes created from the data frame records.

select_cols

an optional character vector for specifying which columns in the data frame file should be imported as node attributes.

drop_cols

an optional character vector for dropping columns from the incoming data.

rename_attrs

an optional character for renaming node attributes.

id_col

an option to apply a column of data in the data frame as node ID values.

type_col

an option to apply a column of data in the data frame as type attribute values.

label_col

an option to apply a column of data in the data frame as label attribute values.

Value

a graph object of class dgr_graph.


[Package DiagrammeR version 0.8.2 Index]