spflow_network-class: Class spflow_network

spflow_network-classR Documentation

Class spflow_network

Description

An S4 class that contains all information on a spatial network which is composed by a set of nodes that are linked by some neighborhood relation. The class is constructed by the spflow_network() function.

Usage

## S4 method for signature 'spflow_network'
dat(object)

## S4 replacement method for signature 'spflow_network'
dat(
  object,
  ...,
  node_key_column,
  node_coord_columns,
  derive_coordinates = FALSE,
  prefer_lonlat = TRUE
) <- value

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

## S4 replacement method for signature 'spflow_network'
id(object) <- value

## S4 method for signature 'spflow_network'
neighborhood(object)

## S4 replacement method for signature 'spflow_network'
neighborhood(object) <- value

## S4 method for signature 'spflow_network'
nnodes(object)

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

Arguments

object

A spflow_network-class

...

not used, required for consistent argument matching (see https://bugs.r-project.org/show_bug.cgi?id=18538)

node_key_column

A character indicating the column containing the identifiers for the nodes

node_coord_columns

A character indicating the columns that represent the coordinates of the nodes. For example c("LON", "LAT").

derive_coordinates

A logical indicating whether there should be an attempt to infer the coordinates from the node_data.

prefer_lonlat

A logical indicating whether the coordinates should be transformed to longitude and latitude.

value

An object to replace the existing id/data/neighborhood

new_dat

A data.frame

Details

The data on each node is stored in a data.frame, where each node must be uniquely identified by a key. The neighborhood relations are described by a matrix that satisfies the usual assumptions of the spatial weight matrix in spatial econometric models. In most cases each node will only neighbor to a few others, in which case the neighborhood matrix is represented as a sparseMatrix(). Function to create spatial neighborhood matrices can be found in the spdep package.

Slots

id_net

A character that serves as an identifier for the set of nodes

node_data

A data.frame that contains all information describing the nodes

node_neighborhood

A matrix that describes the neighborhood relations of the nodes

Examples

## access the data describing the nodes
new_dat <- dat(germany_net)

# access the id of the network
germany_net2 <- germany_net
id(germany_net2)
id(germany_net2) <- "Germany"

# access the neighborhood matrix of the nodes
neighborhood(germany_net)

# access the number of nodes inside the network
nnodes(germany_net)


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