Learn R Programming

multinet (version 3.0.3)

Transformation: Functions to merge multiple layers into one: flattening

Description

These functions merge multiple layers into one. The new layer is added to the network. If the input layers are no longer necessary, they must be explicitely erased.

flatten_ml adds a new layer with the actors in the input layers and an edge between A and B if they are connected in any of the merged layers.

Usage

flatten_ml(mlnetwork, new.layer="flattening", layers=character(0),
  method="weighted", force.directed=FALSE, all.actors=FALSE)

Arguments

mlnetwork

A multilayer network.

new.layer

Name of the new layer.

layers

An array of layers belonging to the network.

method

This argument can take values "weighted" or "or". "weighted" adds an attribute to the new edges with the number of layers where the two actors are connected

force.directed

The new layer is set as directed. If this is false, the new layer is set as directed if at least one of the merged layers is directed.

all.actors

If TRUE, then all the actors are included in the new layer, even if they are not present in any of the merged layers.

Examples

Run this code
# NOT RUN {
net <- ml_aucs()
# A new layer is added to the network, with a flattening of all the other layers
flatten_ml(net, layers=layers_ml(net))
# }

Run the code above in your browser using DataLab