Skip to content
Prev 340837 / 398500 Next

Creating a "very long" function in R

On May 31, 2014, at 3:17 PM, Yuriy Strilets wrote:

            
You should look at:

?funprog


There are several example of repeated applications of a functional argument. Also composition of list of functions.

One instance:

Iterate <- function(f, n = 1)
    function(x) Reduce(Funcall, rep.int(list(f), n), x, right = TRUE)

Iterate(function(x) x^1.1, 30)(1.01)