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
Replacement error message when using "1" or ~1 #206
Comments
I can confirm this issue on windows and linux. |
OK. What happened is I inserted some code that seemed to break a variation on an So I can fix that by reverting to the code I had. That said, you say:
I do not find this example in the vignettes. And the R checking process would have caught the error. So where did you find this example? Do you think this issue is so severe that I need to ask CRAN for an emergency update before 30 days have passed? I'm reluctant to do that... |
Aha -- I found the bug I thought I had fixed: > warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
> emmeans(warp.lm, "1")
1 emmean SE df lower.CL upper.CL
overall 28.1 1.49 48 25.2 31.1
Results are averaged over the levels of: wool, tension
Confidence level used: 0.95
> # OK so far, but a by variable messes it up...
> emmeans(warp.lm, "1", by = "wool")
Error in emmeans(warp.lm, "1", by = "wool") :
No variable named 1 in the reference grid And the issue in question actually wasn't number 200, it was #197. So I have my work cut out for me... |
OK, I think I have both #197 and #206 resolved now: require(emmeans)
## Loading required package: emmeans
#206...
warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
emmeans(warp.lm, "1")
## 1 emmean SE df lower.CL upper.CL
## overall 28.1 1.49 48 25.2 31.1
##
## Results are averaged over the levels of: wool, tension
## Confidence level used: 0.95
emmeans(warp.lm, "1", by = "wool")
## wool = A:
## 1 emmean SE df lower.CL upper.CL
## overall 31.0 2.11 48 26.8 35.3
##
## wool = B:
## 1 emmean SE df lower.CL upper.CL
## overall 25.3 2.11 48 21.0 29.5
##
## Results are averaged over the levels of: tension
## Confidence level used: 0.95
#197...
model <- lm(Sepal.Length ~ poly(Petal.Length,2), data = iris)
emtrends(model, ~ 1, "Petal.Length", max.degree = 2)
## degree = linear:
## 1 Petal.Length.trend SE df lower.CL upper.CL
## overall 0.4474 0.0180 147 0.4119 0.483
##
## degree = quadratic:
## 1 Petal.Length.trend SE df lower.CL upper.CL
## overall 0.0815 0.0132 147 0.0554 0.108
##
## Confidence level used: 0.95 Created on 2020-06-01 by the reprex package (v0.3.0) |
Sorry, I might have misphrased that: this is not actually a "standard" example but one that I found "standard" and reproducible enough. It's the first example (in the pairwise comparisons section) found here in the vignette.
Thanks for such a swift reply and quick solution! |
I think I can close this now. |
I tried to obtain the grand mean for a LMM I fitted using
emmeans(..., spec = "1")
the other day using an older version of theemmeans
package which worked out fine.Today I updated
R
and several other packages (includingemmeans
) due to problems with other packages.When I tried to run the grand mean calculation on my LMM, I got an error message concerning a
data.frame
replacement issue.I tried running the standard example provided in the vignette and it failed with the same error (except for the
value
argument reported in the error message of course).Running it with a
spec
from thelm
works as intended.EDIT
I just ran the code with the old
1.4.6
binary fromCRAN
onR 4.0.0
- this one works. Seems to be an error introduced by version1.4.7
Created on 2020-06-01 by the reprex package (v0.3.0)
Session info
The text was updated successfully, but these errors were encountered: