Sequence based functions, involving indices (or intervals) of minima or maxima.
which.mins (x, …, ret.type="I", endpoints=FALSE)
which.maxs (x, …, ret.type="I", endpoints=FALSE)
which.opts (x, …, ret.type="I", endpoints=FALSE)mins (x, …, intervals.ok=FALSE, endpoints=FALSE)
maxs (x, …, intervals.ok=FALSE, endpoints=FALSE)
opts (x, …, intervals.ok=FALSE, endpoints=FALSE)
An integer/numeric vector.
Logical, if true, optimal regions are allowed, if false (and there are optimal regions), an error is generated.
String, either: "I" (integer vector of indices) "intervals" (two-column integer matrix, representing intervals) "NMP" (integer vector, same as "NMP-") "NMP-" (integer vector of indices, near mid points, rounds down given even length subintervals) "NMP+" (integer vector of indices, near mid points, rounds up given even length subintervals) "MP" (numeric vector of exact midpoints)
Logical vector, of length one or two, to include the first/last values as possible optima.
Ignored.
All "which" functions return an integer vector, which the exception of ret.type="intervals" which returns a two-column integer matrix and ret.type="MP" which returns a numeric vector.
The mins and maxs functions return values from the original vector. They may contain duplicated values.
These functions are designed to find indices or subintervals matching a pattern.
When ret.type="I", the solutions need to be single indices. Otherwise, an error is generated.
When ret.type="intervals" the functions return the starting and ending indices of intervals.
For other return types, a single index is returned for each interval.
Sequence Properties (Other than unique-related properties).
# NOT RUN {
x <- c (2, 1, 0, 1, 2, 1, 0, 1, 2)
which.mins (x)
mins (x)
# }
Run the code above in your browser using DataLab