attrmap function

Network attribute copying/renaming table

Network attribute copying/renaming table

Setting and retrieving rules through which network/edge/vertex attributes are copied or renamed when converting network objects.

attrmap(newdf = NULL)

Arguments

  • newdf: data.frame, new set of copy/rename rules, see Details

Returns

If newdf is NULL, a data frame with the current copy/rename rules. Otherwise newdf are set as new rules and the old ones are returned invisibly, much like par.

Details

Different classes for network data use different attribute names to store the same information. Some of the classes define attributes not used by other classes. This function is used to retrieve or set the rules in which these attributes are copied, renamed or dropped when converting network objects.

The rules are stored in a data frame with the following columns (all of mode character):

  • type: type, or level of the attribute, one of "vertex", "edge" or "network"
  • fromcls: name of the class which is being coerced
  • fromattr: name of the "source" attribute
  • tocls: name of the class to which coercion is being done
  • toattr: name of the attribute in the result of coercion, or NA

When converting network x, of class xclass to network y

of class yclass the coercion method looks up the rows in this table for which fromcls=xclass and tocls=yclass. If network x

has any of the attributes listed in the fromattr in the resulting subset of the table then, it is renamed to the corresponding value of toattr. If toattr is NA the attribute is dropped from the result.

Examples

# Current values attrmap()

See Also

This is used by asIgraph and asNetwork

  • Maintainer: Michał Bojanowski
  • License: GPL-3
  • Last published: 2024-02-01