> Date:   18 Mar 2004 23:52:47 +0100 
> From:   Peter Dalgaard <[EMAIL PROTECTED]>
> To:   <[EMAIL PROTECTED]> 
> Cc:   <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>, <[EMAIL 
> PROTECTED]> 
> Subject:   Re: [R] substitute question 
> 
>  
> "Gabor Grothendieck" <[EMAIL PROTECTED]> writes:
> 
> > From: Peter Dalgaard <[EMAIL PROTECTED]>
> > > (The real pain in these examples is that substitute autoquotes its
> > > expr argument. Therefore, when you want to modify an expression that
> > > is already stored in a variable, you need an extra outer layer of
> > > eval(substitute(...)) to poke the content of the variable into the
> > > inner substitute. An "esub" function with standard evaluation
> > > semantics would make this much easier.)
> > 
> > That is one of the frustrations of using substitute. 
> > 
> > The other is that even if you do perform two levels of substitute,
> > as I have been trying, you still can't count on it working for
> > an arbitrary unevaluated expression, as my examples show. 
> 
> Er, I don't think so. All I have seen is a couple of cases where you
> tried to pass something that was not a language object (e.g. a
> function as opposed to an expression or call generating a function.)
> 
> 

The parse/deparse one definitely is an expression:

> z <- parse(text=deparse(f))
> class(z);mode(z);typeof(z)
[1] "expression"
[1] "expression"
[1] "expression"

In the other one, it is not an expression in the inner substitute
but should be by the time it gets to the outer one since I
explicitly added expression(...).  It is expanded which shows
it did do that part right.

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to