spatial_edge_measures {sfnetworks}R Documentation

Query spatial edge measures

Description

These functions are a collection of specific spatial edge measures, that form a spatial extension to edge measures in tidygraph.

Usage

edge_azimuth(degrees = FALSE)

edge_circuity(Inf_as_NaN = FALSE)

edge_length()

edge_displacement()

Arguments

degrees

Should the angle be returned in degrees instead of radians? Defaults to FALSE.

Inf_as_NaN

Should the circuity values of loop edges be stored as NaN instead of Inf? Defaults to FALSE.

Details

Just as with all query functions in tidygraph, spatial edge measures are meant to be called inside tidygraph verbs such as mutate or filter, where the network that is currently being worked on is known and thus not needed as an argument to the function. If you want to use an algorithm outside of the tidygraph framework you can use with_graph to set the context temporarily while the algorithm is being evaluated.

Value

A numeric vector of the same length as the number of edges in the graph.

Functions

Examples

library(sf, quietly = TRUE)
library(tidygraph, quietly = TRUE)

net = as_sfnetwork(roxel)

net %>%
  activate("edges") %>%
  mutate(azimuth = edge_azimuth())

net %>%
  activate("edges") %>%
  mutate(azimuth = edge_azimuth(degrees = TRUE))

net %>%
  activate("edges") %>%
  mutate(circuity = edge_circuity())

net %>%
  activate("edges") %>%
  mutate(length = edge_length())

net %>%
  activate("edges") %>%
  mutate(displacement = edge_displacement())


[Package sfnetworks version 0.6.4 Index]