Skip to content
Prev 4638 / 63421 Next

How do you construct a function from a list?

Duncan,

I think the easiest approach is to do

	foo <- function() {}
	body(foo) <- forloop

Re the above, I guess Peter would know more about this but is currently
swamped with other work.  I also observe that

R> as.function(alist(forloop))
function () 
list(forloop)
R> as.function(list(forloop))
function () 
list(for (i in 1) junk())

which does not seem right.

-k
	
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._