[R] Packages 'effects' loads 'name' which conflicts with 'lme4' [corrected subject: Package 'effects' loads 'nlme' which conflicts with 'lme4']

John Fox jfox at mcmaster.ca
Thu Mar 8 17:41:39 CET 2012


Dear Spencer,

Perhaps I misunderstand what you suggest, but I don't see how importing
objects helps, when there are objects of the same name in both nlme and lme4
that users of effects will use in different circumstances. That is
effect.lmer() and effect.lme() should both work, though not in the same
session. The solution I'm implementing is to put both lme4 and nlme in
Suggests: and to require() each as needed, presumably not in the same
session, when the package loaded second would mask functions in the package
loaded first.

I'm sure that there are circumstances where this solution isn't appropriate,
but I think that it suffices for the effects package.

Best,
 John

> -----Original Message-----
> From: Spencer Graves [mailto:spencer.graves at structuremonitoring.com]
> Sent: March-08-12 11:11 AM
> To: John Fox
> Cc: r-help at r-project.org; 'Sanford Weisberg'
> Subject: Re: [R] Packages 'effects' loads 'name' which conflicts with
> 'lme4' [corrected subject: Package 'effects' loads 'nlme' which
> conflicts with 'lme4']
> 
> Dear John, et al.:
> 
> 
>        What happens with import(foo) and importFrom(foo, f, g) with foo
> in suggests?  Does foo appear in the search path?  If no, then it may
> be wise to specify all uses in package "mine" of objects from package
> "other" using import and importFrom with "other" in suggests.
> 
> 
>        If this is accurate, then users of "mine" will never have to
> worry about secondary conflicts like "effects" using "name" from either
> "nlme" or "lme4":  The use of "name" from "nlme" in "effects" will not
> cause "nlme" to be loaded.  That means that it won't matter to
> "effects"
> whether and where "lme4" is loaded, and it won't matter to the user,
> either.
> 
> 
>        Might it be good to modify section "1.6.1 Specifying imports and
> exports" of "Writing R Extensions" to make this clear?  I just read it
> now, and it seemed quite clear to me except for this point.
> 
> 
>        Thanks,
>        Spencer
> 
> 
> On 3/8/2012 7:50 AM, John Fox wrote:
> > Dear Spencer,
> >
> >> -----Original Message-----
> >> From: Spencer Graves [mailto:spencer.graves at prodsyse.com]
> >> Sent: March-08-12 10:29 AM
> >> To: Michael Kubovy
> >> Cc: John Fox; r-help
> >> Subject: Re: [R] Packages 'effects' loads 'name' which conflicts
> with
> >> 'lme4' [corrected subject: Package 'effects' loads 'nlme' which
> >> conflicts with 'lme4']
> >>
> >> Dear John, et al.:
> >>
> >>
> >>         What happens if lme4 is loaded before the effect package?
> > Then some functions in it will be masked by nlme, which is loaded
> > along with effects.
> >
> > Sandy Weisberg and I are discussing moving nlme from "Depends" to
> "Suggests"
> > in the effects package Description file to avoid this potential
> problem.
> > Although we'll have to check more carefully, I don't at this point
> see
> > a reason not to do that.
> >
> >>
> >>         Is this an issue of a user wanting to use two different
> >> packages with potentially conflicting names?  What are the standard
> >> recommendations for handling issues like this?  Just to test my
> >> comprehension, I assume that the key is that users should routinely
> >> watch for warnings of name conflicts and follow the advice of sect.
> >> "1.6.1 Specifying imports and exports" of "Writing R Extensions"
> when
> >> that occurs?  (This is another reason for writing R packages and
> >> using namespaces, so users can record appropriately what they want
> in
> >> situations like this and not have to worry about name conflicts
> >> later?)
> > The name conflicts are in lme4 and nlme, which share an author. I
> > think that it's inevitable with 3000+ CRAN packages that there will
> be
> > name conflicts, even if packages only export objects meant for the
> user.
> >
> > Best,
> >   John
> >
> >>
> >>         Thanks,
> >>         Spencer
> >>
> >>
> >> On 3/8/2012 4:19 AM, Michael Kubovy wrote:
> >>> Dear John,
> >>>
> >>> Thanks for the quick response. It works perfectly.
> >>>
> >>> Michael
> >>>
> >>> On Mar 7, 2012, at 9:19 PM, John Fox wrote:
> >>>
> >>>> Dear Michael,
> >>>>
> >>>> effect() works with lmer(). Just load lme4 after the effect
> package.
> >> See the penultimate example in ?effect.
> >>>> I hope this helps,
> >>>> John
> >>>>
> >>>> ------------------------------------------------
> >>>> John Fox
> >>>> Sen. William McMaster Prof. of Social Statistics Department of
> >>>> Sociology McMaster University Hamilton, Ontario, Canada
> >>>> http://socserv.mcmaster.ca/jfox/
> >>>>
> >>>> On Wed, 7 Mar 2012 20:53:20 -0500
> >>>> Michael Kubovy<kubovy at virginia.edu>   wrote:
> >>>>> Hi,
> >>>>>
> >>>>> I would like to use the effect() function (actually a slightly
> >> modified version of it) on the output of the lmer() function in the
> >> lme4 package. But the effects package requires the nlme pacvkage,
> >> which is incompatible with lme4. Workaround?
> >>> ______________________________________________
> >>> Professor Michael Kubovy
> >>> University of Virginia
> >>> Department of Psychology
> >>> for mail add:						for FedEx or
> > UPS add:
> >>> P.O.Box 400400					Gilmer Hall, Room
> > 102
> >>> Charlottesville, VA 22904-4400	485 McCormick Road
> >>> USA
Charlottesville, VA
> > 22903
> >>> 		room	phone
> >>> Office:    B011	+1-434-982-4729
> >>> Lab:        B019	+1-434-982-4751
> >>> WWW:    http://www.people.virginia.edu/~mk9y/
> >>>
> >>>
> >>> 	[[alternative HTML version deleted]]
> >>>
> >>> ______________________________________________
> >>> R-help at r-project.org mailing list
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>> PLEASE do read the posting guide
> >>> http://www.R-project.org/posting-guide.html
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>>
> >>> --
> >>> Spencer Graves, PE, PhD
> >>> President and Chief Technology Officer Structure Inspection and
> >>> Monitoring, Inc.
> >>> 751 Emerson Ct.
> >>> San José, CA 95126
> >>> ph:  408-655-4567
> >>> web:  www.structuremonitoring.com



More information about the R-help mailing list