add_edges_from_df {DiagrammeR} | R Documentation

## Add edges and attributes from a data frame

### Description

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

### Usage

    add_edges_from_df(graph, df, 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`.
`df` | the name of the data frame object.
`from_col` | the name of the data frame 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 data frame 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 data frame's records.
`select_cols` | an optional character vector for specifying which columns in the data frame 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 data frame as `rel` attribute values.

### Value

a graph object of class `dgr_graph`.

[Package DiagrammeR version 0.8.2 Index]