geonetwork {geonetwork}R Documentation

Create geographic networks

Description

Create an igraph object with geospatial attributes for the nodes.

Usage

geonetwork(edges, nodes, directed = TRUE, CRS = 4326)

Arguments

edges

data.frame. Edges list and attributes. See Details.

nodes

data.frame. Nodes list and attributes. See Details.

directed

logical. Default is to build a directed graph.

CRS

Coordinate Reference System, as a numeric or character code, an object of class [sf::sf] or [sf::sfc], or a 'src' object as built by function [sf::st_crs].

Details

The first two columns in edges must be character or factor, and match the node names in the first column of the nodes data.frame. The third column, if any, will be used as edge weights. The remaining columns will be used as additional edge attributes.

The first column in nodes must be character or factor and provide node names or labels, not necessarily unique. Columns 2 and 3 must be numeric coordinates in the Coordinate Reference System specified in CRS.

Value

An object of class geonetwork, which also inherits from igraph.

Examples

  e <- data.frame(from = c("A", "A"), to = c("B", "C"))
  n <- data.frame(id = LETTERS[1:3], x = c(0, 0, 1), y = c(0, 1, 0))
  geonetwork(e, n)

[Package geonetwork version 0.5.0 Index]