binary_Ops: Binary Ops Groups Methods

Description Usage Arguments Note See Also Examples

View source: R/group_methods.R

Description

Apply a binary Ops group method to the observation values of "uts" objects.

Usage

1
binary_Ops(x, Ops, y, times = "all", interpolation = "last")

Arguments

x, y

uts objects.

Ops

a binary Ops operator.

times

which observation times to use for the output time series:

  • "all": the union of observation times of x and y.

  • "x": the observation times of x.

  • "y": the observation times of y.

In all three cases, times before the first observation time (i.e. the start time) of either time series are excluded.
The method for determining these times is unaffected by numerical noise less than sqrt(.Machine$double.eps).

interpolation

either "last" or "linear", denoting the interpolation method to use for sampling from x and y. See sample_values for a detailed description of the two methods.

Note

Ops.uts, when using a binary operator, is a special case of this method. Specifically, x+y gives the same result as binary_Ops(x, "+", y, times="all", interpolation="last"), and the same is true for the other binary "Ops" groupOps methods.

For output times that are observation times of x (or y), the interpolation method has no effect, because the sampled value at such a time point is simply the observation value of x (or y) at this time point. In particular, the interpolation argument has no effect for times="all" (the default).

See Also

Ops.uts, groupGeneric

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Create two sample time series
x <- ex_uts()
y <- head(lag_t(x * 1.1, dhours(1)), 5)

# Vary binary operator
binary_Ops(x, "/", y)
binary_Ops(x, "-", y)
binary_Ops(x, "!=", y)

# Vary time points in output
binary_Ops(x, "/", y)
binary_Ops(x, "/", y, times="x")
binary_Ops(x, "/", y, times="y")

# Vary interpolation method
binary_Ops(x, "/", y)
binary_Ops(x, "/", y, interpolation="linear")

andreas50/uts documentation built on April 8, 2021, 10:03 a.m.