These functions reformat the levels in manynet-consistent network data.
to_onemode() reformats two-mode network data into one-mode network data
by simply removing the nodeset 'type' information.
Note that this is not the same as to_mode1() or to_mode2();
it does not project the two-mode network into one of its modes,
but rather simply removes the distinction between the two modes.
to_twomode() reformats one-mode network data into two-mode network data,
using a mark to distinguish the two sets of nodes.
It also reformats a hypergraph into a two-mode network,
in which each hyperedge is a node of the second mode,
and for this needs no mark.
With through, it projects a network of three or more modes
onto the two modes that through does not name.
Two nodes of these modes get a tie when they have ties
to the same node of through.
For example, in a network of authors, works, and keywords,
to_twomode(.data, through = "works") ties each author
to the keywords of their works.
The weight of the tie is the number of these works.
For valued ties, it adds the products of the two weights.
Other tie attributes, such as layers, are lost.
to_multilevel() reformats two-mode network data into multimodal network data,
which allows for more levels and ties within modes.
If the format condition is not met,
for example to_onemode() is used on a network that is already one-mode,
the network data is returned unaltered.
No warning is given so that these functions can be used to ensure conformance.
Note that a multilevel network is still two-mode, so as_matrix() returns
its incidence matrix. For the square matrix of both modes,
use to_onemode() or as_matrix(.data, twomode = FALSE).
Unlike the as_*() group of functions,
these functions always return the same class as they are given,
only transforming these objects' properties.
to_onemode(.data)
to_twomode(.data, mark, through = NULL)
to_multilevel(.data)An object of a {manynet}-consistent class:
adjacency or incidence matrix from {base} R
edgelist data.frame from {base} R or tbl/tbl_df from {tibble}
stocnet stocnet, from the {manynet} package
igraph igraph, from the {igraph} package
network network, from the {network} package
tidygraph tbl_graph, from the {tidygraph} package
A logical vector marking two types or modes. By default "type".
For a network of three or more modes,
the modes to project through, as indices or names, as for to_mode().
The result is a two-mode network of the two other modes.
Leave mark out when you give through.
An object of the same class as the function was given, modified as explained in the function description, details, or section. Functions that split a network return a list of such objects.
Not all functions have methods available for all object classes. Below are the currently implemented S3 methods: