[R] passing a function as an argument using lazy loading

Mark Heckmann mark.heckmann at gmx.de
Wed Mar 10 13:26:22 CET 2010

I have the following function that makes use of lazy loading.

foo <- function(x=2*y, y=x/2) cat(x,y)

Now I want to be able to modify it like below:


Of course, this does not work as the object x is not known. Still I  
would like to be able to pass a function as an argument that is  
evaluated using lazy loading.

Can someone help?

Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstraße 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com

More information about the R-help mailing list