data.table onto a nanotime vectoralign returns the subset of data.table x that
aligns on the temporal vector y
align(x, y, start, end, ...)# S4 method for data.table,nanotime,nanoduration,nanoduration
align(
x,
y,
start = as.nanoduration(0),
end = as.nanoduration(0),
sopen = FALSE,
eopen = TRUE,
func = NULL
)
# S4 method for data.table,nanotime,missing,missing
align(
x,
y,
start = as.nanoduration(0),
end = as.nanoduration(0),
sopen = FALSE,
eopen = TRUE,
func = NULL
)
# S4 method for data.table,nanotime,nanoduration,missing
align(
x,
y,
start = as.nanoduration(0),
end = as.nanoduration(0),
sopen = FALSE,
eopen = TRUE,
func = NULL
)
# S4 method for data.table,nanotime,missing,nanoduration
align(
x,
y,
start = as.nanoduration(0),
end = as.nanoduration(0),
sopen = FALSE,
eopen = TRUE,
func = NULL
)
# S4 method for data.table,nanotime,nanoperiod,nanoperiod
align(
x,
y,
start = as.nanoperiod(0),
end = as.nanoperiod(0),
sopen = FALSE,
eopen = TRUE,
tz,
func = NULL
)
# S4 method for data.table,nanotime,nanoperiod,missing
align(
x,
y,
start = as.nanoperiod(0),
end = as.nanoperiod(0),
sopen = FALSE,
eopen = TRUE,
tz,
func = NULL
)
# S4 method for data.table,nanotime,missing,nanoperiod
align(
x,
y,
start = as.nanoperiod(0),
end = as.nanoperiod(0),
sopen = FALSE,
eopen = TRUE,
tz,
func = NULL
)
a data.table time-series of the same length as
y; this is a subset of x with the
nanotime index of y
the data.table time-series to align from
the nanotime vector to align to
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 alignment on that
element of y
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 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.
a function taking one argument and which provides an
arbitrary aggregation of its argument; if NULL then a
function which takes the closest observation is used.
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.
For each element in y, intervals are created around this
element with start and end. All the elements of
x that fall within this interval are given as argument to
the function func. The function func show reduce
this data.frame to one unique row that will be associated
with the nanotime value in y.
if (FALSE) {
y <- nanotime((1:10)*1e9)
x <- data.table(index=nanotime((1:10)*1e9), data=1:10)
align(x, y, as.nanoduration(-1e9), as.nanoduration(1e9), colMeans)
}
Run the code above in your browser using DataLab