pair_merge: Create a long form data.frame of origin-destination pairs

pair_mergeR Documentation

Create a long form data.frame of origin-destination pairs

Description

The method merges all available information on origins and destinations to the data.frame describing the OD-pairs.

Usage

pair_merge(object, ...)

## S4 method for signature 'spflow_network_multi'
pair_merge(
  object,
  id_net_pair = id(object)[["pairs"]][[1]],
  dest_cols = NULL,
  orig_cols = NULL,
  pair_cols = NULL,
  make_cartesian = FALSE,
  keep_od_keys = TRUE
)

Arguments

object

A spflow_network_multi-class()

...

Arguments to be passed to methods

id_net_pair

A character indicating the id of a spflow_network_pair-class()

dest_cols

A character, indicating the columns to be kept in the final data.frame that contain information on the nodes in the destination network. (TRUE is a shortcut for everything).

orig_cols

A character, indicating the columns to be kept in the final data.frame that contain information on the nodes in the origin network. (TRUE is a shortcut for everything).

pair_cols

A character, indicating the columns to be kept in the final data.frame that contain information on the origin-destination pairs. (TRUE is a shortcut for everything).

make_cartesian

A logical, when set to TRUE the resulting data.frame contains all possible pairs of origins and destination, even if the data in the spflow_network_pair-class() does not have them.

keep_od_keys

A logical, indicating whether the id of the od should be included.

Value

A single data.frame, combining all available information on origins, destinations and OD pairs

Author(s)

Lukas Dargel

See Also

spflow_network_multi-class()

Examples

# long form data for flows from Germany to Germany
pair_merge(multi_net_usa_ge,"ge_ge")

# long form data for flows from Germany to USA
pair_merge(multi_net_usa_ge,"ge_usa")

LukeCe/spflow documentation built on Nov. 11, 2023, 8:20 p.m.