[R-pkg-devel] package with datasets requiring sp

Andrew Simmons @kw@|mmo @end|ng |rom gm@||@com
Mon Jan 17 17:24:34 CET 2022


If a package is declared in Imports, it means that there must be some kind
of import expression in the NAMESPACE file. For example:

import(sp) # imports the whole sp package, probably NOT what you want
importFrom(sp, Polygon)  # import object Polygon from sp namespace

Theoretically, your import statement could import any of the sp namespace
objects, but it probably makes far more sense to import the datasets from
sp that you're using

On Mon, Jan 17, 2022, 11:11 Aurélie Siberchicot <
aurelie.siberchicot using univ-lyon1.fr> wrote:

> Hi,
>
> I maintain the 'ade4' package which contains data with S4 objects from
> the package 'sp'.
> Some functions of the 'sp' package are also used in examples in some Rd
> files (using the code -- if(requireNamespace("sp", quietly = TRUE)) {} --).
> In February 2020, I moved the 'sp' package from 'Suggests' to 'Imports'
> according to an email received from Brian Ripley, because "At least one
> of the datasets cannot be loaded without a package declared in Suggests:
> -- typically this is because it loads a namespace defining S4 classes,
> and such imports should be declared in Imports or (as Matrix does) use a
> .R wrapper."
>
> For a few months, I have had the following NOTE:
> * checking dependencies in R code ... NOTE
> Namespace in Imports field not imported from: ‘sp’
> All declared Imports should be used.
>
> In 'Writing R Extensions', I found: "Packages needed to use datasets
> from the package should be in ‘Imports’: this includes those needed to
> define S4 classes used."
>
> Moving back 'sp' in 'Suggests' seems to solves the NOTE but is contrary
> to the recommendations of 'Writing R Extensions' and Brian Ripley.
> I'm a bit confused to solve this note and the best way to declare the
> dependency of 'ade4' to 'sp'.
> Is anyone in my situation? Does anyone have any advice?
>
> Thanks in advande for any help.
> Cheers.
> Aurélie.
>
>
>
>
>
> --
> Aurélie SIBERCHICOT
> Ingénieure en Ingénierie Logicielle
> 04 72 44 85 98 - aurelie.siberchicot using univ-lyon1.fr
>
> Laboratoire Biométrie et Biologie Evolutive - UMR CNRS 5558
> Université Claude Bernard - Lyon 1
> Bâtiment Grégor Mendel, 43 boulevard du 11 novembre 1918
> 69622 Villeurbanne cedex
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list