Description Usage Arguments Details Value Functions Examples
These functions use a vector and a function to create an iterable object that can be used for vector comprehension.
1 2 3 4 5 6 7 8 9 10 11 |
x |
vector |
f |
function to be applied to |
axis |
which axis to perform different operations? |
... |
additional arguments passed to lower functions. See |
longest |
logical; should the longest item be used to determine the new length or shortest? Defaults to |
fill |
object with which to fill the vector when operating on elements with varying lengths or shifts. |
The star
functions are similar to their funprog
counterparts,
except that they are applied one level deeper in the list.
list or other vector
starmap
: Use map
f
on each element of x
.
starred
: Use reduce
f
on each element of x
.
starfilter
: Use filter
f
on each element of x
.
partition
: Map predicate function f
to each object in x
and split based on which items evaluate to TRUE
(index 1) vs. FALSE
(index 2).
dropwhile
: Drop objects from x
until predicate function f
evaluates to FALSE
.
takewhile
: Keep objects from x
until predicate function f
evaluates to FALSE
.
1 2 3 4 5 6 7 8 9 | x <- list(1:3, 4:6, 7:9)
## filter away values less than 6
starfilter(x, ~.i > 5)
starfilter(x, ~.i > 5, axis=1) # Transposed
starred(x, `/`, init=1) # sequentially divide each item, starting at 1
partition(x, ~.i > 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.