Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples
Various pems.utils functions to merge data of different types.
1 2 3 4 5 6 7 8 9 10 |
x, y |
(Required objects, typically pems objects, data.frames or vectors) For |
... |
(Optional) Other arguments, currently passed on to |
by |
(Optional numeric or character) When |
y.offset |
(Function or numeric) The number of rows to offset data in |
all |
(Currently disabled) Argument in revision. |
suffixes |
(Logical, or character) Any suffixes to be added to |
offset.range |
(Numeric) For |
bindPEMS is a column binding function that binds various objects types (e.g.
pems objects, data.frames and vectors) and returns results as
pems objects. It uses cAlign to bind associated data. Also, if requested,
it uses findLinearOffset to handle alignments.
cAlign is a modification of the standard R column binding function
cbind. cAlign binds data.frames (or vectors) subject
to an applied offset, y.offset. The row displacement of the second
data.frame relative to the first. Unlike cbind, cAlign does not
require x and y to have the same number of columns. See NOte below.
findLinearOffset is a wrapper for the R function ccf.
It is a lag function to find the best linear offset between two data series.
bindPEMS returns supplied objects, x and y, as a single pems object,
subject to requested alignment and naming modifications.
cAlign returns supplied objects, x and y, as a single data.frame,
subject to requested alignment and naming modifications.
findLinearOffset returns the best fit offset for y relative to x.
No warnings
cAlign generates offsets and pads out data.frames of different column lengths by
the addition of NAs. So, data.frames do not need to be the same column length to
be bound, and alignment is subject y.offset, a numeric giving the starting row for
y relative to x. data.frame names are handled using make.names,
by the suffixes argument to manage names directly.
Karl Ropkins
References in preparation.
See cbind for standard column binding in R.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ###########
##example 1
###########
#some data
temp <- rnorm(500)
#get two offset ranges
x <- temp[25:300]
y <- temp[10:200]
plot(x, type="l"); lines(y, col="blue", lty=2)
#estimated offset
findLinearOffset(x,y)
#[1] -15
#applying linear offset
ans <- cAlign(x,y, findLinearOffset(x,y))
plot(ans$x, type="l"); lines(ans$y, col="blue", lty=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.