seqapply
family of functions behaves much like the existing
lapply
family, except the return value is cast to a
Vector subclass. This facilitates constraining
computation to the Vector
framework across iteration and
(for seqsplit
) splitting.
## The 'seqapply' family:
seqapply(X, FUN, ...)
mseqapply(FUN, ..., MoreArgs = NULL, USE.NAMES = TRUE)
tseqapply(X, INDEX, FUN = NULL, ...)
seqsplit(x, f, drop = FALSE)
seqby(data, INDICES, FUN, ...)
## Reverse seqsplit():
"unsplit"(value, f, drop = FALSE)
"split"(x, f, drop = FALSE, ...) <- value
Vector
X
X
X
FUN
that are treated like scalars
list
of factors to split X
into subsets, each of
which is passed in a separate invocation of FUN
INDEX
, except a single factor need not be in a
list
.
factor
or list
of factors
FUN
List
object for the functions in the seqapply
family.
seqapply
family should be used just like
their base equivalent:
seqapply
lapply
mseqapply
mapply
tseqapply
tapply
seqsplit
split
seqby
by
The only difference is that the result is cast to a Vector
object. The casting logic simply looks for a common class from which
all returned values inherit. It then checks for the existence of a
function of the form ClassList
where Class
is the name
of the class. If such a function is not found, the search proceeds up
the hierarchy of classes. An error is thrown when hierarchy is
exhausted. If ClassList
is found, it is called with the list of
return values as its only argument, under the assumption that
a Vector
-derived instance will be constructed.
unsplit
unlists value
, where the order of the returned
vector is as if value
were originally created by splitting that
vector on the factor f
.
split(x, f, drop = FALSE) <- value
: Virtually splits x
by
the factor f
, replaces the elements of the resulting list with the
elements from the list value
, and restores x
to its original
form. Note that this works for any Vector
, even though split
itself is not universally supported.