st_as_graph: Create an sfnetwork

View source: R/sfnetworks.R

st_as_graphR Documentation

Create an sfnetwork

Description

Given an sf or sfc object and neighbor and weights lists, create an sfnetwork object.

Usage

st_as_graph(x, nb, wt)

## S3 method for class 'sf'
st_as_graph(x, nb, wt)

## S3 method for class 'sfc'
st_as_graph(x, nb, wt)

Arguments

x

object of class sf or sfc.

nb

a neighbor list. If x is class sf, the unquote named of the column. If x is class sfc, an object of class nb as created from st_contiguity().

wt

optional. A weights list as generated by st_weights(). . If x is class sf, the unquote named of the column. If x is class sfc, the weights list itself.

Value

an sfnetwork object

See Also

st_as_nodes() and st_as_edges()

Examples


if (requireNamespace("dplyr", quietly = TRUE)) {
library(magrittr)

guerry_nb %>%
  st_as_graph(nb, wt)
}

JosiahParry/sfdep documentation built on Sept. 7, 2024, 6:15 a.m.