Learn R Programming

oeli (version 0.5.2)

match_numerics: Best-possible match of two numeric vectors

Description

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)

Value

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

Arguments

x

A numeric vector.

y

Another numeric vector of the same length as x.

Examples

Run this code
x <- c(-1, 0, 1)
y <- c(0.1, 1.5, -1.2)
match_numerics(x, y)

Run the code above in your browser using DataLab