Get index of element in vector with value closest to a target
closest_to_target(vector, target)
Arguments
vector |
Identify element in this numeric vector |
target |
numeric target |
Value
an integer indexing vector
Examples
#> [1] 1
#> [1] 2
#> [1] 1
#> [1] 3