align_idx returns the index of the alignment of x on y
align_idx(x, y, start, end, ...)# S4 method for 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 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 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 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 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 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 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
)
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
the nanotime vector to align from
the nanotime vector to align to
scalar or vector of same length as y of type
nanoduration or nanoperiod; start is
added to each element in y and it then defines the
starting point of the interval under consideration for the
alignment on that element of y
scalar or vector of same length as y of type
nanoduration or nanoperiod; start is
added to each element in y and it then defines the
ending point of the interval under consideration for the
alignment on that element of y
further arguments passed to or from methods.
boolean scalar or vector of same lengths as y
that indicates if the start of the interval is open or
closed. Defaults to FALSE.
boolean scalar or vector of same lengths as y
that indicates if the end of the interval is open or
closed. Defaults to TRUE.
logical indicating if the sorting of
x should be bypassed. This can provide a marginal
speedup, but should be used carefully.
logical indicating if the sorting of
y should be bypassed. This can provide a marginal
speedup, but should be used carefully.
scalar or vector of same length as y of type
character. Only used when the type of start and
end is nanoperiod. It defines the time zone for
the definition of the interval.
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.
if (FALSE) {
align_idx(nanotime(c(10:14, 17:19)), nanotime(11:20))
## [1] 2 3 4 5 NA NA 6 7 8 NA
}
Run the code above in your browser using DataLab