这有效:
testmodel=glm(breaks~wool,data=warpbreaks)
emmeans::emmeans(testmodel,"wool")
这有效:
warpbreaks %>%
group_by(tension) %>%
do(models=glm(breaks~wool,data=.)) %>%
ungroup() %>%
mutate(means=map(models,~emmeans::emmeans(.x,"wool")))
这不会:
warpbreaks %>%
group_by(tension) %>% nest() %>%
mutate(models=map(data,~glm(breaks~wool,data=.x))) %>%
mutate(means=map(models,~emmeans::emmeans(.x,"wool")))
Error in is.data.frame(data) : object '.x' not found
Error in mutate_impl(.data, dots) :
Evaluation error: Perhaps a 'data' or 'params' argument is needed.
知道是什么原因造成的吗?