[Bioc-devel] Reducing number of dependencies

顾祖光 jokergoo @end|ng |rom gm@||@com
Tue Jul 6 12:23:36 CEST 2021


Hi David,

My experience is to put those packages that are necessary for the "core
analysis" in your package to Depends/Imports and put those packages that
are only needed for the "additional analysis" in your package to Suggests.
Then in the function which needs these "suggested packages", you can write
like:

if(!requireNamespace(pkg)) {
   stop("You need to install pkg to perform this analysis.")
}

An example from my package:
https://github.com/jokergoo/spiralize/blob/master/R/graphics.R#L1355.

Cheers,
Zuguang


On Tue, 6 Jul 2021 at 03:52, David Jimenez-Morales <biodavidjm using gmail.com>
wrote:

> Dear Bioc gurus,
>
> I am trying to reduce the number of dependencies in my package. One of the
> suggestions is:
>
>   Importing from so many packages makes the package vulnerable to any of
> >   them becoming unavailable.  Move as many as possible to Suggests and
> >   use conditionally.
>
>
> In a script I would do something like this...
>
> list.of.packages <- c("pk1", "pk2")
> new.packages <- list.of.packages[!(list.of.packages %in%
> installed.packages()[,"Package"])]
> if(length(new.packages)) install.packages(new.packages)
>
> but how should this be done for a bioconductor package?
>
> Thank you very much!
> David
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list