Correlation based (linear) alignment, row
offsetting second of two vectors or data.frames
based on best fit as estimated by correlation coefficient.
Arguments
- x
First
vectorordata.frame, to be aligned and merged with.- y
Second
vectorordata.frame, to align and merge withx.- by
If
xoryaredata.frames, the names of the columns thatcor_alignshould align with.- ...
Other arguments:
min.overlapBy default,
cor_aligncompares correlations for lags withx/yoverlaps of 2000 rows or 20% if smaller. Other minimum (row number) overlaps can be set using the extra argumentmin.overlap.outputThe default
cor_alignoutputisc("plot", "summary", "ans").outputoptions include:"ans","plot","summary"and"alignment". Multipleoutputs are allowed, but only the last is captured by return.alignmentis a special object class which may be helpful to those looking at alignments in more detail.
Value
By default, cor_align returns x and y
as an aligned data.frame. It also provides a lag correlation
profile (plot) and alignment report. See above about modifying
outputs.
