Skip to contents

Takes a list of causal relationships tables and creates all pairwise relationships between each of the columns specified in the from-to pairs. Can be geographically filtered by gauge or planning unit

Usage

make_edges(
  dflist,
  fromtos,
  fromfilter = NULL,
  tofilter = NULL,
  gaugefilter = NULL,
  pufilter = NULL,
  gaugeplanmatch = NULL,
  extrasave = NULL
)

Arguments

dflist

list of tibbles or dataframes containing the matches between nodes. Single dataframes may hold multiple relationships. List of dataframes because some relationships are at different scales

fromtos

list of length-2 character vectors c('from', 'to'), giving the column names of the node categories to connect (and implies directionality).

fromfilter

character vector of nodes to include (a subset of the nodes in the from column. Default NULL includes all nodes within the column.

tofilter

character vector of nodes to include (a subset of the nodes in the to column. Default NULL includes all nodes within the column

gaugefilter

character vector of gauge numbers to include. Default NULL includes all gauges

pufilter

character vector of planning units to include. Default NULL includes all planning units

gaugeplanmatch

dataframe of matches between gauges and planning units. If such a dataframe is not passed (the default, gaugeplanmatch = NULL), the function attempts to find a dataframe in dflist that has both and create the matching internally. gaugeplanmatch is used to check consistency if both gaugefilter and pufilter are passed, and to get the other when only one is passed

extrasave

Any other columns to retain from the original datasets that might be desired attributes later. Default NULL retains none.

Value

a tibble with columns for gauge and planning_unit_name (where included), from and to columns indicating the directionality of pairings, fromtype and totype for the type of node being connected, and an edgeorder column for the order in which the edges were passed (previously used for plotting, now deprecated).