These functions add some format to manynet-consistent data.

  • to_labelled() reformats unlabelled network data to labelled network data from a vector of names or random baby names.

  • to_unlabelled() reformats labelled network data to unlabelled network data.

If the format condition is not met, for example to_undirected() is used on a network that is already undirected, the network data is returned unaltered. No warning is given so that these functions can be used to ensure conformance.

Unlike the as_*() group of functions, these functions always return the same class as they are given, only transforming these objects' properties.

to_labelled(.data, names = NULL)

to_named(.data, names = NULL)

to_unlabelled(.data)

to_unnamed(.data)

Arguments

.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

names

Character vector of the node names. NULL by default.

Value

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.

Details

Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:

              data.frame default igraph matrix network tbl_graph
to_labelled            *       *      *      *       *         *
to_unlabelled          *       *      *      *       *         *