Integer giving the number of vector elements to include
in the subsets. Defaults to the lesser of the length of the data and
20 elements.
allow.fewer
Boolean indicating whether the function should be
computed for subsets with fewer than width points
pad
Boolean indicating whether the returned results should
be 'padded' with NAs corresponding to sets with less than
width elements. This only applies when when
allow.fewer is FALSE.
align
One of "right", "center", or "left".
This controls the relative location of ‘short’ subsets with less
then width elements: "right" allows short subsets only at the
beginning of the sequence so that all of the complete subsets are at
the end of the sequence (i.e. ‘right aligned’), "left" allows short
subsets only at the end of the data so that the complete subsets
are ‘left aligned’, and "center" allows short subsets at both ends
of the data so that complete subsets are ‘centered’.
simplify
Boolean. If FALSE the returned object will be a list
containing one element per evaluation. If TRUE, the returned
object will be coerced into a vector (if the computation returns a
scalar) or a matrix (if the computation returns multiple values).
Defaults to FALSE.
by
Integer separation between groups. If by=width will
give non-overlapping windows. Default is missing, in which case
groups will start at each value in the X/Y range.
...
parameters to be passed to fun
Details
running applies the specified function to
a sequential windows on X and (optionally) Y. If
Y is specified the function must be bivariate.
Value
List (if simplify==TRUE), vector, or matrix containg the
results of applying the function fun to the
subsets of X (running) or X and Y.
Note that this function will create a vector or matrix even for
objects which are not simplified by sapply.