-
Notifications
You must be signed in to change notification settings - Fork 60
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
Unexpected call_env
/ summary_flags
behaviour in model objects when called within a function.
#514
Comments
Hi, thanks for reporting and the very clear issue. |
Hi! Sorry to re-open this issue, I ran into another manifestation of this. This time, running Just a quick hack to verify this, j is the result of an
And then just as further proof that the environment is the culprit (if the identical sizes weren't obvious), observe that the AIC object is just a function, and so should be tiny, if not for the attached environment:
I assume this didn't show up earlier because There's no rush on fixing this, I mitigate the problem by manually nulling out things in the mean time. Thanks for your great support on this bug and the other one I reported. |
I am running models on enormous amounts of data (20-odd million observations, 1000-odd variables counting FEs). We want to store fit model objects so that we can dynamically re-run various outputs (etable, coefplot, etc.). We run the models with clustered SEs and store the lean versions of the models in rds files for use on other machines.
I am running into an unusual case where the fit model objects end up enormous when the models are assembled inside function calls.
Here's an example. It's not quite a reprex, because you need the data, but I think it at least gives an intuition:
This is not a misfire from pryr; attempts to serialize the resulting objects to a file reflect the same size disparity. I introspected the objects to figure out where the disconnect is:
The discrepancy in
call
is clearly use the length of the data argument being shrunk. Let's not worry about that. But as you can see, the summary_flags and the call_env are both carrying around the environment of the call in full, even withlean = TRUE
given as an argument.I can solve the problem by NULLing out these objects before serializing, and it doesn't seem to cause any downstream issues I wouldn't expect. I assume this is an oversight.
Suggested fix: have
lean = TRUE
drop the environment from the result object.The text was updated successfully, but these errors were encountered: