Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formula environment causing error #34

ngreifer opened this issue Jun 8, 2018 · 2 comments


None yet
2 participants
Copy link

commented Jun 8, 2018

See this example:

X <- rnorm(100)
Y <- rnorm(100)
F <- function(f) summ(glm(f))
F(Y ~ X)

## Error: object of type 'symbol' is not subsettable 

The traceback is:

10. notnull(x$formula) 
9. formula.default(object, env = baseenv()) 
8. formula(object, env = baseenv()) 
7. as.formula(old) 
6. update.formula(call$formula, formula) 
5. j_update(object, formula = form, weights = .weights, offset = .offset, 
    data = frame) 
4. pR2(model) 
3. summ.glm(glm(f)) 
2. summ(glm(f)) 
1. F(Y ~ X) 

I think this is occurring because the environment in which you are evaluating the formula when decomposing the glm object is not the same environment with the data. Note that this occurs even when a data set is included in glm. This isn't a huge problem but points to a possible underlying issue. The way around it is to pass the glm object to F() rather than just the formula.

@jacob-long jacob-long closed this in 26b4bf5 Jun 9, 2018


This comment has been minimized.

Copy link

commented Jun 9, 2018

Programmatic model updating is a bear. I think I've fixed it.


This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2018

Yup! Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.