[R] as.function parameters

jackl jackspam at hotmail.de
Wed May 9 15:13:02 CEST 2012


Hi,

i have a question regarding the as.function functionality.
I need to save multiple functions with adjusted parameters in a list.
The adjusted parameters are changed via variables in a loop.
The problem I'm facing right now is that the functions saved in
the list don't have the values of the parameters but the variable parameter
itself. Is there a way to force a call-by-value instead of a
call-by-address?

Example(not the real function):
tmp <- 4
f <- as.function(alist(y=,x=tmp,y+x)
f(1) > 5
tmp <- 2
f(1) > 3

thanks ahead and sorry if this question has already been asked before.
I could not really grasp the problem to one Subject.

--
View this message in context: http://r.789695.n4.nabble.com/as-function-parameters-tp4620390.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list