Skip to content
Prev 206832 / 398503 Next

Predict polynomial problem

and the values in those 
places are different:
On Tue, 19 Jan 2010, Barry Rowlingson wrote:

            
Per ?bquote, "bquote quotes its argument except that terms wrapped in 
'.()' are evaluated in the specified 'where' environment.

(which by default is the parent.frame)

Note:
y ~ poly(x, 20)
So, now 'i' is irrelevant as the expression returned by bquote has '20' as 
the 'degree' arg.
Well, the terms() objects are the same:
[1] TRUE
but they will look in different places for 'i':
<environment: 0x01b7c178>
<environment: R_GlobalEnv>
and the values in those places are different:
[1] 2
[1] 3
It doesn't need 'i', because the i was evaluated and substituted by 
bquote. That is, it doesn't get("i") as the expression returned by bquote 
has no 'i' in it.

HTH,

Chuck
Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901