[Rd] problem with eval(..., parent.frame(1L)) when package is not loaded
pdalgd at gmail.com
Fri Jun 28 20:22:38 CEST 2013
On Jun 28, 2013, at 18:42 , Ben Bolker wrote:
> Duncan Murdoch <murdoch.duncan <at> gmail.com> writes:
>> The other choice is to use the explicit ::, i.e.
>> mc[] <- quote(lmer::lFormula)
>> This would be the solution I'd prefer, but you seem to have some
>> prejudice against :: .
> I just thought that the whole point of using the machinery of
> namespaces, environments, etc., was that we shouldn't need to
> tell R explicitly what environment we were working in ...
Not really. The point is to avoid name clashes. In a sense, the fundamental mode of operation is to use qualified names, but there are convenience features that let you use them unqualified by attaching or importing (parts of) the namespace. But, if, as in the present case, you can't assume that the lmer namespace is imported/attached by the caller, you likely shouldn't force it to be so for an eval.parent()-type call. So the qualified name is a natural solution in that case.
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-devel