Usage
slice(x, pivot, inclusive=FALSE) slice(x, expression)Details
This function splits a sequence into two adjacent sub-sequences
at a pivot point or based on a logical expression. If a pivot
point is chosen, then the inclusive parameter determines whether
the value associated with the pivot should be included in both
sub-sequences. If FALSE, then the indices of the sub-sequences
will have the form [1, pivot], [pivot + 1, n], where n = |x|. If
inclusive is TRUE, then the sub-sequences have indices of
[1, pivot], [pivot, n]. Obviously the pivot must be an element
of the set of indices of x. An alternative construction is to use an expression to define
a slice point. The first sub-sequence corresponds to the
values where the expression evaluated to TRUE, while the
second sequence corresponds to values when the expression
evaluated to FALSE. In two dimensions only the first variant of this function is
defined, as it cannot be guaranteed that a regular matrix will
be generated using an arbitrary expression.