The subset argument is evaluated in "data" first, then in the caller's
environment, etc.
So:
1) In your first example, stype is a *vector*, and the subset
expression is identically TRUE, hence is equivalent to making the call
without the subset argument.
2) The second call fits the subset with st
When you use the data= argument in glm(), the function looks in the data.frame
for a variable first. You have created two versions of stype, one in the
data.frame and one outside it. So your first glm() selects all the cases
apistrat since apistrat$stype always equals apistrat$stype. You can see
2 matches
Mail list logo