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

.robustDigest(env) that contains a lme4 generated object corrupts the original lme4 object #115

Closed
tati-micheletti opened this issue Apr 25, 2019 · 1 comment

Comments

@tati-micheletti
Copy link
Contributor

tati-micheletti commented Apr 25, 2019

This does not happen to stats::lm.

Reprex on Cache + env + glmer problem

env <- new.env()
dt <- data.frame(a = c(1, 5, 10),
b = c(2, 3, 7),
re = c(1, 1, 3))
modGlmer <- list(MOD1 = lme4::glmer(formula = a ~ b + (1|re), data = dt, family = "poisson"))
modLmer <- list(MOD2 = lme4::lmer(formula = a ~ b + (1|re), data = dt))
modLm <- list(MOD3 = stats::lm(formula = a ~ b, data = dt))

assign(x = "modGlmer",
value = modGlmer,
envir = env)
assign(x = "modLmer",
value = modLmer,
envir = env)
assign(x = "modLm",
value = modLm,
envir = env)

tryCatch(print(modGlmer), error = function(e)
message("Original object modGlmer was modified by reproducible:::.robustDigest and returns error"))
tryCatch(print(modLmer), error = function(e)
message("Original object modLmer was modified by reproducible:::.robustDigest and returns error"))
tryCatch(print(modLm), error = function(e)
message("Original object modLm was modified by reproducible:::.robustDigest and returns error"))

reproducible:::.robustDigest(env)

tryCatch(print(modGlmer), error = function(e)
message("Original object modGlmer was modified by reproducible:::.robustDigest and returns error"))
tryCatch(print(modLmer), error = function(e)
message("Original object modLmer was modified by reproducible:::.robustDigest and returns error"))
tryCatch(print(modLm), error = function(e)
message("Original object modLm was modified by reproducible:::.robustDigest and returns error"))

eliotmcintire added a commit that referenced this issue Apr 25, 2019
eliotmcintire added a commit that referenced this issue Apr 26, 2019
@achubaty
Copy link
Collaborator

achubaty commented May 3, 2019

@tati-micheletti can you please confirm that Eliot's fix solves the problem? thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants