Description Usage Arguments Details Value Author(s) See Also Examples
Applies a specified function to sections of an input signal in between specified index
points. The indices can be supplied explicitly in the idx
parameter, or as the
logical vector btm
in which the divider points are set to TRUE
. By default,
the link{median}
of each segment is calculated.
1 | apply.breaks(x, btm = NULL, f = median, idx = (1:length(btm))[btm])
|
x |
The data vector whose segments are to be processed. |
btm |
A logical vector containing |
f |
A function object to apply to each segment of data. Should return a single value.
The default is to use the |
idx |
A vector of indices at which the data vector should be split into segments. The data
at the index is not included in the segment. Either this or |
Unbounded stretches at each end are dropped, as are empty regions (i.e. regions between adjacent
dividers). Thus, if there are N
divider points there will be at most N-1
returned
values (and possibly fewer).
A vector containing the function results for each non-empty segment.
Matthew Caldwell
1 2 | x <- rnorm(500)
apply.breaks(x, idx=50 * 1:10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.