manip_reformat function

Modifying network formats

Modifying network formats

These functions reformat manynet-consistent data.

  • to_acyclic() reformats network data to an acyclic graph.
  • to_anti() reformats network data into its complement, where only ties not present in the original network are included in the new 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.

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

to_acyclic(.data) to_anti(.data) to_redirected(.data) to_reciprocated(.data) to_directed(.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

Returns

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.

Details

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

data.frameigraphmatrixnetworktbl_graph
to_acyclic11111
to_anti11111
to_reciprocated11111
to_redirected11111

Functions

  • to_redirected(): Returns an object that has any edge direction transposed, or flipped, so that senders become receivers and receivers become senders. This essentially has no effect on undirected networks or reciprocated ties.
  • to_reciprocated(): Returns an object where all ties are reciprocated.

Examples

to_anti(ison_southern_women) #graphr(to_anti(ison_southern_women))

See Also

Other modifications: manip_as, manip_correlation, manip_deformat, manip_from, manip_levels, manip_miss, manip_nodes, manip_paths, manip_permutation, manip_preformat, manip_project, manip_scope, manip_split, manip_ties

  • Maintainer: James Hollway
  • License: MIT + file LICENSE
  • Last published: 2024-11-05