Sequence based functions, involving indices (or intervals) of minima or maxima.
which.mins (v, …, what="I", ends=FALSE)
which.maxs (v, …, what="I", ends=FALSE)
which.opts (v, …, what="I", ends=FALSE)which.level (v, …, what="intervals")
which.decreasing (v, …, what="intervals")
which.increasing (v, …, what="intervals")
which.nondecreasing (v, …, what="intervals")
which.nonincreasing (v, …, what="intervals")
which.nonlevel (v, …, what="intervals")
mins (v, …, allow.intervals=FALSE, ends=FALSE)
maxs (v, …, allow.intervals=FALSE, ends=FALSE)
opts (v, …, allow.intervals=FALSE, ends=FALSE)
An integer/numeric vector, with length two or more.
Logical, if true, optimal sections (which two or more equal values) are allowed, if false and there are optimal sections, 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) "XMP" (numeric vector of exact midpoints) "first" (integer vector of first indices) "last" (integer vector of last indices)
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 what="intervals" which returns a two-column integer matrix and what="XMP" 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 what="I", the solutions need to be single indices. Otherwise, an error is generated. (Note that "I" is not allowed, for the which.level function).
When what="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