[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-devel
Subject:    Re: [Rd] Imports problem
From:       "Therneau, Terry M., Ph.D." <therneau () mayo ! edu>
Date:       2015-02-16 14:04:47
Message-ID: 1e7ee5$2glv2 () ironport10 ! mayo ! edu
[Download RAW message or body]

On 02/16/2015 07:35 AM, Duncan Murdoch wrote:
> If you are depending on nlme, you don't also need to import it. But it
> is generally a good practice to avoid either modifying or relying on the
> search list:  as people get more packages there, there are more chances
> for clashes.
I would suggest adding the second sentence above to the "Writing R extensio=
ns" manual.  At =

least for me, it made the :: argument much clearer in the following paragra=
ph (found =

there).  Before the "why" was a bit mysterious, now I have a motivation to =
make some of =

these changes in my own code.

"R code in the package should call library or require only exceptionally. S=
uch calls are =

never needed for packages listed in =91Depends=92 as they will already be o=
n the search path. =

It used to be common practice to use require calls for packages listed in =
=91Suggests=92 in =

functions which used their functionality, but nowadays it is better to acce=
ss such =

functionality via :: calls."

I disagree with the above sentence in one case, however.  That is in a vign=
ette where one =

is showing the user a direction that they might go themselves.  For example=
 I'm currently =

working on a competing risks vignette for the survival package which shows =
how to do a =

particular analysis and then has a section on "if you choose to fit a Fine-=
Gray model =

instead, this is how it compares".  Since any user who wanted to fit that m=
odel would =

themselves start with "library(cmprsk)", the vignette does so too.  My argu=
ment is =

pedagogical rather than technical.

Last note: your first sentence clashes with one in the Writing R extensions=
 manual. =

"Almost always packages mentioned in =91Depends=92 should also be imported =
from in the =

NAMESPACE file: this ensures that any needed parts of those packages are av=
ailable when =

some other package imports the current package."

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic