| align_idx {dtts} | R Documentation |
Get the index of the alignment of one vector onto another
Description
align_idx returns the index of the alignment of x on y
Usage
align_idx(x, y, start, end, ...)
## S4 method for signature 'nanotime,nanotime,nanoduration,nanoduration'
align_idx(
x,
y,
start,
end,
sopen = FALSE,
eopen = TRUE,
bypass_x_check = FALSE,
bypass_y_check = FALSE
)
## S4 method for signature 'nanotime,nanotime,missing,missing'
align_idx(
x,
y,
start,
end,
sopen = FALSE,
eopen = TRUE,
bypass_x_check = FALSE,
bypass_y_check = FALSE
)
## S4 method for signature 'nanotime,nanotime,missing,nanoduration'
align_idx(
x,
y,
start,
end,
sopen = FALSE,
eopen = TRUE,
bypass_x_check = FALSE,
bypass_y_check = FALSE
)
## S4 method for signature 'nanotime,nanotime,nanoduration,missing'
align_idx(
x,
y,
start,
end,
sopen = FALSE,
eopen = TRUE,
bypass_x_check = FALSE,
bypass_y_check = FALSE
)
## S4 method for signature 'nanotime,nanotime,nanoperiod,nanoperiod'
align_idx(
x,
y,
start = as.nanoperiod(0),
end = as.nanoperiod(0),
sopen = FALSE,
eopen = TRUE,
tz,
bypass_x_check = FALSE,
bypass_y_check = FALSE
)
## S4 method for signature 'nanotime,nanotime,missing,nanoperiod'
align_idx(
x,
y,
start = as.nanoperiod(0),
end = as.nanoperiod(0),
sopen = FALSE,
eopen = TRUE,
tz,
bypass_x_check = FALSE,
bypass_y_check = FALSE
)
## S4 method for signature 'nanotime,nanotime,nanoperiod,missing'
align_idx(
x,
y,
start = as.nanoperiod(0),
end = as.nanoperiod(0),
sopen = FALSE,
eopen = TRUE,
tz,
bypass_x_check = FALSE,
bypass_y_check = FALSE
)
Arguments
x |
the |
y |
the |
start |
scalar or vector of same length as |
end |
scalar or vector of same length as |
... |
further arguments passed to or from methods. |
sopen |
boolean scalar or vector of same lengths as |
eopen |
boolean scalar or vector of same lengths as |
bypass_x_check |
logical indicating if the sorting of
|
bypass_y_check |
logical indicating if the sorting of
|
tz |
scalar or vector of same length as |
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.
When only x and y are specified, the
default is to close the intervals so that the alignment simply
picks up equal points. Note that it is possible to specify
meaningless intervals, for instance with a start that
is beyond end. In this case, the alignment will simply
return NA for each element in y. In principle, the
start and end are chosen to define an interval
is the past, or around the points in y, but if they are
both positive, they can define intervals in the future.
Value
a vector of indices of the same length as y; this
vector indexes into x and represent the closest point
of x that is in the interval defined around each point
in y
Examples
## Not run:
align_idx(nanotime(c(10:14, 17:19)), nanotime(11:20))
## [1] 2 3 4 5 NA NA 6 7 8 NA
## End(Not run)