Calculate connectivity metrics

calc_metrics(lines, lakes, map = FALSE)

Arguments

lines

sf lines object

lakes

sf polygon object

map

logical show a map output of the results?

Value

a list with the following elements:

  • Average link length

  • Stream order ratio

  • Closest lake distance

  • Number of upstream lakes

  • Upstream lake area

Details

The units returned depend on the data source. Check with sf::st_crs.

Examples

if (FALSE) {

data(nhd_sub_lines)
data(nhd_sub_lakes)
coords <- c(lon = -73.17581, lat = 41.38634)

calc_metrics(nhd_sub_lines, nhd_sub_lakes)

# don't error if lines is only one row
calc_metrics(nhd_sub_lines[1,], nhd_sub_lakes)

}