as_igraph: Convert 'egor' object to 'network' or 'igraph' objects

View source: R/conversions.R

as_igraphR Documentation

Convert egor object to network or igraph objects

Description

These functions convert an egor object into a list of network or igraph objects. By default ego itself is not included in the created objects, there is a parameter (include.egor) that allows for including ego.

Usage

as_igraph(
  x,
  directed = FALSE,
  include.ego = FALSE,
  ego.attrs = NULL,
  ego.alter.weights = NULL,
  graph.attrs = ".egoID"
)

## S3 method for class 'nested_egor'
as_igraph(
  x,
  directed = FALSE,
  include.ego = FALSE,
  ego.attrs = NULL,
  ego.alter.weights = NULL,
  graph.attrs = ".egoID"
)

## S3 method for class 'egor'
as.igraph(
  x,
  directed = FALSE,
  include.ego = FALSE,
  ego.attrs = NULL,
  ego.alter.weights = NULL,
  graph.attrs = ".egoID"
)

as_network(
  x,
  directed = FALSE,
  include.ego = FALSE,
  ego.attrs = NULL,
  ego.alter.weights = NULL,
  graph.attrs = ".egoID"
)

## S3 method for class 'egor'
as.network(
  x,
  directed = FALSE,
  include.ego = FALSE,
  ego.attrs = NULL,
  ego.alter.weights = NULL,
  graph.attrs = ".egoID"
)

Arguments

x

An egor object.

directed

Logical, indicating if alter-alter relations are directed.

include.ego

Logical. Should ego be included?

ego.attrs

Vector of names (character) or indices (numeric) of ego variables that should be carried over to the network/ igraph objects. This is ignored, when include.ego = FALSE (default).

ego.alter.weights

Vector of names (character) or indices (numeric) of alter variables that should be carried over to the the network/ igraph objects, as edge attributes of the ego-alter relations. This is ignored, when 'include.ego = FALSEā€œ (default).

graph.attrs

Vector of names (character) or indices (numeric) of ego variables that are supposed to be carried over to the igraph object as graph attributes or the network object as network attributes. By default .egoID is carried over.

Details

The names of the variables specified in ego.attr and ego.alter.attr need to be the same as the names of corresponding alter attributes, in order for those variables to be merged successfully in the resulting network/ igraph object (see example).

Examples

e <- make_egor(3, 22)
as_igraph(e)

egor documentation built on March 31, 2023, 11:33 p.m.