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
calling lmer from within a package that Suggests:
or Imports:
#50
Comments
Could another workaround be to add |
Maybe, but that feels like a hack. We should (ideally) figure out how this is supposed to work rather than cluttering up our code with |
Agreed. |
Agreed.... if it worked at all. As I think this is all linked to the non-standard Martin |
It's (for once) not actually very deeply buried. The relevant code is just:
So this is a fairly standard trick -- e.g. just the same as what lm() uses to construct the model.frame. It occurred to me to try setting the enclosing environment, but I don't know if that's just making things more complicated than they need to be ... |
hOn Thu, Jun 27, 2013 at 7:34 PM, Ben Bolker notifications@github.comwrote:
indeed..... and I now checked: R_DEFAULT_PACKAGES=NULL R --vanilla .... and try a simple lm() using stats::lm(....) you also get an error, about function "model.frame" not found. So we could ask R-core if this is not a "bug" to be fixed... Martin
|
I think you can use
The key is to let R know the symbol I just tested this between two packages, and this trick worked. |
Along the lines of Yihui's suggestion, how about just:
|
Duncan Murdoch also suggests |
No, Yihui's solution will also make the error messages ugly. That's because, like my proposed code, it works by substituting the value of Duncan Murdoch's second suggestion, on the other hand, -- doing |
OK, I gave up and used |
Several packages (
aod
,EquiNorm
) calllmer
from within package functions, but they onlySuggest:
(aod
) orImport:
(EquiNorm
)lme4
. This leads to an error when we useeval(mc, parent.frame(1L))
to pass the arguments off tolFormula
: R can't findlFormula
in the parent frame -- presumably (although I don't understand this as well as I'd like to)lFormula
can be found when called from the context of package functions, but not when called from the global environment.In fact, we can get the same thing simply by calling
without loading
lme4
first.A reasonable workaround is to make the package
Depend:
onlme4
... although it shouldn't have to.The text was updated successfully, but these errors were encountered: