[R] passing a function as an argument using lazy loading
ligges at statistik.tu-dortmund.de
Sun Mar 14 15:43:36 CET 2010
On 10.03.2010 13:26, Mark Heckmann wrote:
> I have the following function that makes use of lazy loading.
I guess you mean *lazy evaluation* rather than *lazy loading* (as used
in loading functions or data from the package databases).
> foo <- function(x=2*y, y=x/2) cat(x,y)
> Now I want to be able to modify it like below:
You really want to *modify* the list of formal arguments like that or do
you want to *call* it like that?
> 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.
If you rephrase your question more exactly and give a more elaborated
example where you want to make use of it, we may be able to help, but I
do not want to answer based on speculations here.
> 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
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help