align | R Documentation |
Aligns or interpolates a time series or signal to new positions.
align(x, pos, how="NA", error.how="NA", localzone=FALSE, matchtol=0, by,
k.by=1, week.align=NULL, holidays=timeDate())
x |
the object to be aligned or interpolated. | ||||||||||||
pos |
the new positions to align or interpolate it to
(either | ||||||||||||
how |
specifies how to treat unmatched positions. Must be one of the following:
| ||||||||||||
error.how |
specifies available actions when an out of bounds error occurs. (Such an error can occur
when
| ||||||||||||
localzone |
if T ( | ||||||||||||
matchtol |
the tolerance for matching positions. Positions that match within | ||||||||||||
by |
if
Alternatively, it can be one of the following character strings:
These strings give the time units of intervals between values in the sequence. | ||||||||||||
k.by |
a non-zero integer giving the width of the interval between consecutive
values in the sequence in terms of the units given in | ||||||||||||
week.align |
if not | ||||||||||||
holidays |
the holidays for business day sequences. (Ignored if |
If either x
or pos
(or the generated sequence) has zero length,
a zero-length series is returned.
returns a new time series or a signal whose positions are the passed-in positions or
positions generated from by
, k.by
, and so on, and whose
rows are derived from x
as specified in the arguments.
(Can be a subset if how
or error.how
is "drop"
.)
timeSeries
, signalSeries
, positions
, seriesMerge
.
a <- signalSeries(pos=1:10, data=data.frame(a = 11:20, b = 5 * (1:10)))
align(a, c(.2, 3, 7.8, 12), how = "interp", error.how = "nearest")
a <- timeSeries(pos=as(1:10, "timeDate"),
data=data.frame(a = 11:20, b = 5 * (1:10)))
alpos <- as(c(.2, 3, 7.8, 12), "timeDate")
alpos@time.zone <- "JST"
positions(a)@time.zone <- "PST"
align(a, alpos, matchtol = 1, localzone = TRUE)
align(a, matchtol=1, localzone=TRUE, by="days", k.by=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.