Skip to content
Prev 136518 / 398498 Next

stumped by eval

Ross Boylan wrote:
Yes, this is elusive, but it is not actually eval() that is doing you 
in. It is the notion of a model environment, see the last bit of ?formula.

The point is that subset (and offset) arguments are subject to the same 
evaluation rules as the terms inside the formula: First look in "data", 
then in the environment of the formula, which in this case is the global 
environment.

This behaviour is generally a good thing because it prevents you from 
accidentally picking up internal variables of f1, but working around it 
can be a little painful. As far as I recall, you can use an explicit 
substitute of the subset argument.