Skip to contents

This function matches the indices of two numeric vectors as good as possible (that means with the smallest possible sum of deviations).

Usage

match_numerics(x, y)

Arguments

x, y

[numeric()]
Two vectors of the same length.

Value

An integer vector of length length(x) with the positions of y in x.

Examples

x <- c(-1, 0, 1)
y <- c(0.1, 1.5, -1.2)
match_numerics(x, y)
#> [1] 2 3 1