do_align | R Documentation |
The first vector serves as a reference, the second vector is shifted, such that it aligns best with the first and has the same length as the first vector.
do_align(y1, y2, min.overlap = 0.1 * max(length(y1), length(y2)))
y1 |
vector of striation marks (assuming equidistance between values) |
y2 |
vector of striation marks |
min.overlap |
integer value: what is the minimal number of values between y1 and y2 that should be considered? |
list consisting of a) the maximal cross correlation, b) the lag resulting in the highest cross correlation, and c) a vector of length y1 with aligned values of y2.
library(dplyr)
x <- runif(20)
do_align(x, lead(x, 5))
do_align(x, lag(x, 5), min.overlap=2)
do_align(x, lag(x, 5), min.overlap=3)
do_align(x, x[-(1:5)], min.overlap=3)
do_align(x[-(1:5)], x, min.overlap=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.