Skip to content
Prev 294298 / 398503 Next

as.function parameters

Hello,

I'm not completely sure if I understand, but maybe using environments.
If each function copy in the list has a different environment, you can set
the parameters values in that environment.
Something like


f <- as.function(alist(y=,x=tmp,y+x))

env <- list(
	e1=new.env(),
	e2=new.env()
)
fun <- list(
	f1=f,
	f2=f
)

environment(fun$f1) <- env$e1
environment(fun$f2) <- env$e2
env$e1$tmp <- 2
env$e2$tmp <- 4
fun$f1(1)
fun$f2(1)


Also, a code example would be nice, like this I'm just guessing.

Hope this helps,

Rui Barradas

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