From antonio.fabio at gmail.com  Mon Dec 18 19:06:46 2006
From: antonio.fabio at gmail.com (Antonio, Fabio Di Narzo)
Date: Mon, 18 Dec 2006 19:06:46 +0100
Subject: [Rd] turning expression object to function
Message-ID: <b0808fdc0612181006t5316da91pe6192333c03b2c94@mail.gmail.com>

Dear all,
I have the following problem.

Given an expression object 'expr' containing a certain set of symbols
(say 'a', 'b', 'c'), I would like to translate the expression object
in an R function of, say, 'a', programmatically. Here an example of
what I mean.

Given:
> expr <- expression(a+b+c)

a call like:
> asFunctionOf(expr, 'a', list(b=1, c=2))

should return a function (not necessarly formally) equivalent to
> function(a) a+1+2

Some suggestions?

Best regards,
Antonio.



[Rd] turning expression object to function
Antonio, Fabio Di Narzo