View source: R/roll_statistics.R
roll_circstats | R Documentation |
A generic function for applying a function to rolling margins of an array.
roll_circstats(
x,
w = NULL,
FUN,
axial = TRUE,
na.rm = TRUE,
width = NULL,
by.column = FALSE,
partial = TRUE,
fill = NA,
...
)
x |
numeric vector. Values in degrees. |
w |
(optional) Weights. A vector of positive numbers and of the same
length as |
FUN |
the function to be applied |
axial |
logical. Whether the data are axial, i.e. pi-periodical
( |
na.rm |
logical value indicating whether |
width |
integer specifying the window width (in numbers of observations)
which is aligned to the original sample according to the |
by.column |
logical. If |
partial |
logical or numeric. If |
fill |
a three-component vector or list (recycled otherwise) providing
filling values at the left/within/to the right of the data range. See the
fill argument of |
... |
optional arguments passed to |
numeric vector with the results of the rolling function.
If the rolling statistics are applied to values that are a function of distance it is recommended to sort the values first.
data("plates")
plate_boundary <- subset(plates, plates$pair == "na-pa")
data("san_andreas")
PoR <- subset(nuvel1, nuvel1$plate.rot == "na")
distance <- distance_from_pb(
x = san_andreas,
PoR = PoR,
pb = plate_boundary,
tangential = TRUE
)
dat <- san_andreas[order(distance), ]
roll_circstats(dat$azi, w = 1 / dat$unc, circular_mean, width = 51)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.