purrr
purrr copied to clipboard
safely causes error in glm
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>