Correlation based (linear) alignment, row offsetting second of two vectors or data.frames based on best fit as estimated by correlation coefficient.

# Default S3 method
cor_align(x, y = NULL, by = NULL, min.overlap = NULL, ...)

Arguments

x

First vector or data.frame, to be aligned and merged with.

y

Second vector or data.frame, to align and merge with x.

by

If x or y are data.frames, the names of the columns that cor_align should align with.

min.overlap

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.

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. The extra function, output, can be used to modify this behavior (see also alignment).

Note

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.

Author

Karl Ropkins