itabulate | R Documentation |
Constructs an iterator that maps a given function over an indefinite sequence
of numeric values. The input the function f
is expected to accept a
single numeric argument. The sequence of arguments passed to f
begin
with start
and are incremented by step
.
itabulate(f, start = 1, step = 1)
f |
the function to apply |
start |
sequence's initial value |
step |
sequence's step size |
an iterator that returns the mapped values from the sequence
it <- itabulate(f=function(x) x + 1)
take(it, 4) # 2 3 4 5
it2 <- itabulate(f=function(x) x^2, start=-3)
take(it2, 6) # 9 4 1 0 1 4
it3 <- itabulate(abs, start=-5, step=2)
take(it3, 6) # 5 3 1 1 3 5
it4 <- itabulate(exp, start=6, step=-2)
take(it4, 4) # exp(c(6, 4, 2, 0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.