circular | R Documentation |
Functions for circular descriptive statistics
circ_mean(x, int, type = c("minusPiPlusPi", "ZeroPlus2Pi"), na.rm = FALSE)
circ_mean_weighted(
x,
w,
int,
type = c("minusPiPlusPi", "ZeroPlus2Pi"),
na.rm = FALSE
)
circ_range(x, int, na.rm = FALSE)
circ_sd(x, int, na.rm = FALSE)
x |
A numeric vector or a matrix. If a data.frame is supplied, then
|
int |
A numeric value. The number of units of |
type |
A character string. If |
na.rm |
A logical value indicating whether |
w |
A numeric vector. The weights for |
A numeric value or NA
.
mean.circular
,
range.circular
,
sd.circular
## Examples with `circ_mean`
x <- 1:3
circ_mean(x, int = 12, type = "minusPiPlusPi") ## expected 2
circ_mean(x, int = 12, type = "ZeroPlus2Pi") ## expected 2
x <- (-2):0
circ_mean(x, int = 12, type = "minusPiPlusPi") ## expected -1
circ_mean(x, int = 12, type = "ZeroPlus2Pi") ## expected 11
x <- (-5):5
circ_mean(x, int = 12, type = "minusPiPlusPi") ## expected 0
circ_mean(x, int = 12, type = "ZeroPlus2Pi") ## expected 12
x <- (-5):8
circ_mean(x, int = 12, type = "minusPiPlusPi") ## expected -4.5
circ_mean(x, int = 12, type = "ZeroPlus2Pi") ## expected 7.5
## Examples with `circ_mean_weighted`
x <- seq_len(12)
w <- c(1, rep(0, 7), 1, 1, 2, 1)
stats::weighted.mean(x, w) ## expected 9
circ_mean_weighted(x, w, int = 12, type = "minusPiPlusPi") ## expected -1
circ_mean_weighted(x, w, int = 12, type = "ZeroPlus2Pi") ## expected 11
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.