nsink_get_closest_lt: Get closest, but less than

View source: R/utils.R

nsink_get_closest_ltR Documentation

Get closest, but less than

Description

This function will return the index of one vector that is closest and less than, by absolute values, to the values in another vector. If the value in v1 is less than all values in v2, then just the next closest is returned. Usually used to identify the closest lake or stream, in area or length respectively, to another lake or stream.

Usage

nsink_get_closest_lt(v1, v2)

Arguments

v1

The first vector of values, likely length or area of a feature

v2

The second vector of values, also likely length or area of a feature.

Value

Returns a vector, of length v1, of the index from v2 that is less than and closest in absolute value to each value in v1.


USEPA/nsink documentation built on Feb. 8, 2025, 12:27 p.m.