df_to_vert_attr: Set the vertex attributes of a graph

Description Usage Arguments

View source: R/df_to_vert_attr.R

Description

Given a graph and a data frame where vertex names correspond to a column in the data frame, map data in the data frame to attributes of the vertices in the graph.

Usage

1
df_to_vert_attr(graph, df, common, attr_name, new_attr_name = NULL)

Arguments

graph

Graph of class 'igraph'

df

A data frame that has a column that contains vertex IDs and at least one column that has data that will become a vertex attribute of graph.

common

A character string providing the column name that contains the vertex IDs (i.e., the 'name' vertex attribute of the graph).

attr_name

A character vector providing the name(s) of the column of df that will be added as vertex attributes to graph

new_attr_name

A character vector providing the name(s) of the new vertex attribute(s). If NULL then the name of the new attribute(s) will match attr_name.


taylorpourtaheri/nr documentation built on Dec. 23, 2021, 7:49 a.m.