graph_to_sf: Convert an igraph object with lon/lat attributes to an SF...

Description Usage Arguments Value Functions

View source: R/sf.R

Description

This expects graph to have a lat and lon vertex attribute, however you may pass in alternate numeric vectors to v_lat and v_lon.

Usage

1
2
3
4
5
6
7
8
graph_to_sf(graph, v_lat = igraph::vertex_attr(graph, "lat"),
  v_lon = igraph::vertex_attr(graph, "lon"))

edges_to_sf(graph, v_lat = igraph::vertex_attr(graph, "lat"),
  v_lon = igraph::vertex_attr(graph, "lon"))

nodes_to_sf(graph, v_lat = igraph::vertex_attr(graph, "lat"),
  v_lon = igraph::vertex_attr(graph, "lon"))

Arguments

graph

An igraph object

v_lat

Numeric. Latitude values for each vertex

v_lon

Numeric. Longitude values for each vertex

Value

A named list with an edges and a nodes sfc object.

Functions


dSHARP-CMU/konigsbergr documentation built on Sept. 11, 2019, 3:55 p.m.