View source: R/circular_functions.R
circ_add | R Documentation |
Calculate the circular addition x + y
circ_add(x, y, int, type = c("minusPiPlusPi", "ZeroPlus2Pi"))
x |
A numeric vector or array. |
y |
A numeric vector or array. |
int |
A numeric value. The number of units of |
type |
A character string. If |
# Matrix examples: day of year
x <- matrix(c(260, 240, 10, 360, 0, 360), nrow = 3, ncol = 2)
y <- matrix(c(240, 260, 360, 10, 360, 0), nrow = 3, ncol = 2)
circ_add(x, y, int = 365)
circ_add(x, y, int = 365, type = "ZeroPlus2Pi")
# Circular addition and subtraction
r1 <- circ_add(circ_minus(x, y, int = 365), y, int = 365)
r2 <- circ_minus(circ_add(x, y, int = 365), y, int = 365)
all.equal(r1, r2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.