# NOT RUN {
{
x <- c(2200, 4500, 4600, 6400, 1600) # target
y <- c(1100, 1150, 1200, 6400, 1600) # reference
i <- matchIndices(x, y, 1) # find best match
# plot x (blue), and selected y (red)
plot(1:5, replicate(5,0), ylim=c(0,10000), type="l")
lines(i$x, x[i$x], type="l", col="blue")
lines(i$y, y[i$y], type="l", col="red")
}
# }
Run the code above in your browser using DataLab