align.idx: Get the index of the alignment of one vector onto another

Description Usage Arguments Details Value Examples

View source: R/dtts.utils.R

Description

align.idx returns the index of the alignment of x on y

Usage

1
align.idx(x, y, start = as.integer64(0), end = as.integer64(0))

Arguments

x

the nanotime vector to align from

y

the nanotime vector to align to

start

scalar or vector of same length as y of type integer64; start is added to each element in y and it then defines the starting point of the interval under consideration for the alignement on that element of y

end

scalar or vector of same length as y of type integer64; start is added to each element in y and it then defines the ending point of the interval under consideration for the alignement on that element of y

Details

In order to perform the alignment, intervals are created around each elements in y using start and end. For each such interval, the closest element in x is chosen. If no element in x falls in the interval, then NaN is returned.

Value

a vector of indices of the same length as y; this vector indexes into x and represents the points in x that are aligned with the points in y

Examples

1
2
3
4
5
## Not run: 
align.idx(nanotime(c(10:14, 17:19)), nanotime(11:20), as.integer64(-1), as.integer64(0))
## [1]  2  3  4  5  5 NA  6  7  8  8

## End(Not run)

lsilvest/dtts.utils documentation built on Feb. 8, 2020, 5:43 p.m.