Correlation based (linear) alignment, row
offsetting second of two vector
s or data.frame
s
based on best fit as estimated by correlation coefficient.
# Default S3 method
cor_align(x, y = NULL, by = NULL, min.overlap = NULL, ...)
First vector
or data.frame
, to be aligned
and merged with.
Second vector
or data.frame
, to align and
merge with x
.
If x
or y
are data.frame
s, the names
of the columns that cor_align
should align with.
By default, cor_align
compares
correlations for lags with x
/y
overlaps of
2000 rows or 20% if smaller. Other minimum (row number)
overlaps can be set using the extra argument min.overlap.
Other arguments, typically handled by common
alignment
functions/methods or ignored.
By default, cor_align
returns x
and y
as an aligned data.frame
. It also provides a lag correlation
profile (plot) and alignment report. The extra function
,
output
, can be used to modify this behavior (see also
alignment
).
cor_align
is based on cAlign
function in
earlier version of pems.utils
. It works with vectors,
data.frames and other objects that can be converted to data.frame
with as.data.frame(), and uses Rcpp
to run C++
code.