reformat {manynet}R Documentation

Modifying network formats

Description

These functions reformat manynet-consistent 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.

Usage

to_uniplex(.data, tie)

to_undirected(.data)

to_directed(.data)

to_redirected(.data)

to_reciprocated(.data)

to_acyclic(.data)

to_unweighted(.data, threshold = 1)

to_unsigned(.data, keep = c("positive", "negative"))

to_unnamed(.data)

to_named(.data, names = NULL)

to_simplex(.data)

to_anti(.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

tie

Character string naming a tie attribute to retain from a graph.

threshold

For a matrix, the threshold to binarise/dichotomise at.

keep

In the case of a signed network, whether to retain the "positive" or "negative" ties.

names

Character vector of the node names. NULL by default.

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_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
to_undirected 1 1 1 1 1
to_uniplex 1 1 1 1 1
to_unnamed 1 1 1 1 1
to_unsigned 1 1 1 1 1
to_unweighted 1 1 1 1 1

Value

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.

Functions

See Also

Other modifications: add_nodes(), add_ties(), as(), from, miss, split(), to_levels, to_paths, to_project, to_scope

Examples

as_tidygraph(create_filled(5)) %>%
  mutate_ties(type = sample(c("friend", "enemy"), 10, replace = TRUE)) %>%
  to_uniplex("friend")
to_anti(ison_southern_women)
#autographr(to_anti(ison_southern_women))

[Package manynet version 0.4.4 Index]