[Rd] Depends/Imports/Suggest/Enhence

Marc Schwartz marc_schwartz at me.com
Tue Nov 6 18:18:40 CET 2012


On Nov 6, 2012, at 11:00 AM, Marc Schwartz <marc_schwartz at me.com> wrote:

> 
> On Nov 6, 2012, at 10:36 AM, Simon Urbanek <Simon.Urbanek at r-project.org> wrote:
> 
>> 
>> On Nov 6, 2012, at 11:19 AM, Christophe Genolini wrote:
>> 
>>> Hi the list
>>> 
>>> In the DESCRIPTION file of my package foo0, I have:
>>> 
>>> Depends: foo1
>>> Imports: foo2
>>> Suggest: foo3
>>> Enhence: foo4
>>> 
>> 
>> (it is really "Suggests" and "Enhances" - the above are typos I presume and thus won't be recognized)
>> 
>> 
>>> If I understand correctly, to install foo0 on my computer, I need to already have foo1, foo2, foo3. 
>>> foo4 is not necessary.
>>> 
>> 
>> No, you only need foo1 and foo2. The other two are optional.
> 
> 
> Just to add another option here, you need not have foo1 and foo2 already installed to install foo0. You can use:
> 
>  install.packages("foo0", dependencies = TRUE)
> 
> and that will install foo1 and foo2 at the same time. 'dependencies' defaults to FALSE. See ?install.packages for more info.


Actually, a correction here. 'dependencies' defaults to NA, which will handle Depends, Imports and LinkingTo for the packages explicitly listed in the 'pkgs' argument.

TRUE adds handling for Suggests in the packages listed in the 'pkgs' argument and then additional Depends, Imports and LinkingTo in other packages brought in as further dependencies. So if you get into nested package dependencies, you would want to use this.

Marc


> 
> Regards,
> 
> Marc Schwartz
> 
> 
>> 
>>> I my R sesssion, when I will write: library(foo0), then the package foo1 will be attach. foo2, foo3 
>>> and foo4 will not. Is that correct?
>>> 
>> 
>> Yes
>> 
>> 
>>> But what is the difference between Import and Suggest?
>>> 
>> 
>> "Imports" means that symbols are imported form the namespace, so they are mandatory for the package to operate. "Suggests" means that symbols from the package are not required, but they are used in examples or vignettes, so the listed package(s) will be needed for a full check. They are not needed for the operation of the package, though.
>> 
>> Cheers,
>> Simon
>> 
>> 
>>> Christophe
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list