These functions add some format to manynet-consistent data.

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

  • to_unnamed() 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_named(.data, names = NULL)

to_unnamed(.data)

Arguments

.data

An object of a {manynet}-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

names

Character vector of the node names. NULL by default.

Value

A tidygraph object modified as explained in the function description, details, or section.

Details

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

           data.frame igraph matrix network tbl_graph
to_named            *      *      *       *         *
to_unnamed          *      *      *       *         *