spflow_network_multi-class: Class spflow_network_multi

spflow_network_multi-classR Documentation

Class spflow_network_multi

Description

An S4 class that gathers information on multiple objects of types spflow_network-class() and spflow_network_pair-class(). Its purpose is to ensure that the identification between the nodes that serve as origins or destinations, and the OD-pairs is consistent (similar to relational data bases).

Usage

## S4 method for signature 'spflow_network_multi'
id(object)

## S4 method for signature 'spflow_network_multi'
complete_pairs(object, ids_spflow_pairs = id(object)[["pairs"]])

## S4 method for signature 'spflow_network_multi'
dat(object, .id)

## S4 replacement method for signature 'spflow_network_multi'
dat(object, .id) <- value

## S4 method for signature 'spflow_network_multi'
neighborhood(object, .id)

## S4 method for signature 'spflow_network_multi'
nnodes(object, .id)

## S4 method for signature 'spflow_network_multi'
npairs(object, .id)

## S4 method for signature 'spflow_network_multi'
pull_member(object, .id = NULL)

## S4 method for signature 'spflow_network_multi'
update_dat(object, new_dat)

Arguments

object

spflow_network_multi-class

ids_spflow_pairs

A character indicating of one or several spflow_network_pair() objects

.id

A character, corresponding to the id of a spflow_network() object contained in the spflow_network_multi

value

A data.frame to replace the existing data

new_dat

A named list of data.frames that contain the new data. The names should correspond to spflow_network or spflow_pair objects contained in the spflow_network_multi-class().

Slots

nodes

A list of spflow_network-class() objects

pairs

A list of spflow_network_pair-class() objects

Examples

## access the id of the objects inside the spflow_network_multi

id(multi_net_usa_ge)$nodes
id(multi_net_usa_ge)$pairs

## access the data inside a spflow_network_multi

dat(multi_net_usa_ge, "ge")    # extract data of nodes
dat(multi_net_usa_ge, "ge_ge") # extract data of pairs

## access the data of a network or a network_pair inside a multi_network

dat(multi_net_usa_ge, "ge")    # extract data of nodes
dat(multi_net_usa_ge, "ge_ge") # extract data of pairs

## access spflow_network or spflow_network_pair inside a spflow_network_multi

pull_member(multi_net_usa_ge, .id = "ge")
pull_member(multi_net_usa_ge, .id = "usa")
pull_member(multi_net_usa_ge, .id ="ge_ge")


# update data for individual observations
new_ge <- dat(multi_net_usa_ge, "ge")[1:2,1:2]
new_ge$X <- new_ge$X * .25
multi_net_usa_ge2 <- update_dat(multi_net_usa_ge, list("ge" = new_ge))
dat(multi_net_usa_ge2, "ge")


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