These functions add some format to manynet-consistent data.
to_directed()
reformats undirected network data to a directed network.
to_redirected()
reformats the direction of directed network data, flipping any existing direction.
to_reciprocated()
reformats directed network data such that every directed tie is reciprocated.
to_acyclic()
reformats network data to an acyclic graph.
to_named()
reformats unlabelled network data to labelled network data
from a vector of names or random baby names.
to_signed()
reformats unsigned network data to signed network data
with signs from a mark vector or at random.
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_signed(.data, mark = NULL)
to_weighted(.data, measure = NULL)
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
Character vector of the node names. NULL by default.
A mark (logical vector) the length of the ties in the network.
A numeric vector (measure) that will be added as the tie weights to the network. If this is NULL, then the tie weights will be drawn from a Poisson distribution with \(\lambda = 4\).
All to_
functions return an object of the same class as that provided.
So passing it an igraph object will return an igraph object
and passing it a network object will return a network object,
with certain modifications as outlined for each function.
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_acyclic | 1 | 1 | 1 | 1 | 1 |
to_directed | 1 | 1 | 1 | 1 | 1 |
to_named | 1 | 1 | 1 | 1 | 1 |
to_reciprocated | 1 | 1 | 1 | 1 | 1 |
to_redirected | 1 | 1 | 1 | 1 | 1 |
to_simplex | 0 | 1 | 1 | 0 | 1 |
Other modifications:
manip_as
,
manip_correlation
,
manip_deformat
,
manip_from
,
manip_levels
,
manip_miss
,
manip_nodes
,
manip_paths
,
manip_permutation
,
manip_project
,
manip_reformat
,
manip_scope
,
manip_split
,
manip_ties