Description Usage Arguments Details Value Examples
Matches two vectors with different lengths based on their maximum value.
1 | matchIndices(x, y, z)
|
x |
Target numeric vector. |
y |
Reference numeric vector. |
z |
A numeric element. |
Uses Dynamic Time Wrapping (DTW) to match x and y. z determines the buffer size - expressed in number of data points - used to search for matching records.
A list with selected indices for x and y.
1 2 3 4 5 6 7 8 9 10 11 12 13 | {
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")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.