Learn R Programming

DiagrammeR (version 0.8.1)

add_edges_from_csv: Add edges and attributes from a CSV file

Description

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

Usage

add_edges_from_csv(graph, csv_path, from_col, from_attr, to_col, to_attr,
  set_rel = NULL, select_cols = NULL, drop_cols = NULL,
  rename_attrs = NULL, rel_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.
from_col
the name of the CSV column from which edges originate.
from_attr
the mapping of from_col values to attributes of the graph's nodes.
to_col
to_col the name of the CSV column to which edges terminate.
to_attr
the mapping of to_col values to attributes of the graph's nodes.
set_rel
an optional string to apply a rel attribute to all edges created from the CSV records.
select_cols
an optional character vector for specifying which columns in the CSV file should be imported as edge attributes.
drop_cols
an optional character vector for dropping columns from the incoming data.
rename_attrs
an optional character vector for renaming edge attributes.
rel_col
an option to apply a column of data in the CSV file as rel attribute values.

Value

  • a graph object of class dgr_graph.