purrr icon indicating copy to clipboard operation
purrr copied to clipboard

safely causes error in glm

Open izahn opened this issue 3 years ago • 0 comments

Calling a safe version of glm fails when using the offset argument.

library(purrr)
library(tibble)

set.seed(7) ## doesn't matter just for reproducibility
exd <- tibble(x = rnorm(10),
              y = sample(0:1, 10, TRUE),
              w = rnorm(10))

## works
glm(y ~ x, offset=exd$w, family = quasibinomial, data=exd)
## doesn't work
safeglm <- safely(glm)
safeglm(y ~ x, offset=exd$w, family = quasibinomial, data=exd)
#$result
#NULL
#
#$error
#<simpleError in eval(extras, data, env): ..2 used in an incorrect context, no ... to look in>

izahn avatar Jan 25 '22 00:01 izahn