Learn R Programming

DiagrammeR (version 0.8.1)

add_nodes_from_csv: Add nodes and attributes from a CSV file

Description

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

Usage

add_nodes_from_csv(graph, csv_path, 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.
csv_path
a path to a CSV file.
set_type
an optional string to apply a type attribute to all nodes created from the CSV records.
select_cols
an optional character vector for specifying which columns in the CSV 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 CSV file as node ID values.
type_col
an option to apply a column of data in the CSV file as type attribute values.
label_col
an option to apply a column of data in the CSV file as label attribute values.

Value

  • a graph object of class dgr_graph.