Learn R Programming

stplanr (version 1.2.2)

rnet_connected: Keep only segments connected to the largest group in a network

Description

This function takes an sf object representing a road network and returns only the parts of the network that are in the largest group.

Usage

rnet_connected(rnet)

Value

An sf object representing the largest group in the network

Arguments

rnet

An sf object representing a road network

Examples

Run this code
rnet <- rnet_breakup_vertices(stplanr::osm_net_example)
rnet_largest_group <- rnet_connected(rnet)
plot(rnet$geometry)
plot(rnet_largest_group$geometry)

Run the code above in your browser using DataLab