powered by
Iteratively (recursively) apply a function to its own output
iapply(X, FUN, init, ...)
a vector of first arguments to be passed in
a function taking a changing (x) and an initial argument (init)
an argument to be "worked on" by FUN with parameters x[1], x[2], etc.
Arguments passed to FUN.
the final value, of the same type as init
# NOT RUN { vec <- "xy12" mylist <- list( c("x","a"), c("y","b"), c("a","f") ) iapply( mylist , FUN=function(repvec,x) { gsub(repvec[1],repvec[2],x) }, init=vec ) # }
Run the code above in your browser using DataLab