Message-ID: <947d32f8-46c0-75ed-08e7-c071e0b1770e@univ-lyon1.fr>
Date: 2022-01-18T09:03:09Z
From: Aurélie Siberchicot
Subject: [R-pkg-devel] package with datasets requiring sp
In-Reply-To: <CAPcHnpQJvgV5mjPiDYRDF=uaXd+gBrrzq_EA=RH_z84rPfJQWA@mail.gmail.com>
Thank you Andrew !
I think I didn't explain my context correctly.
I'm not importing datasets from 'sp'. I have datasets that are built
from S4 objects of sp.
In pratical terms, I don't import anything from 'sp' but I need 'sp' for
my datasets to exist.
Cheers.
Aur?lie.
Le 17/01/2022 ? 17:24, Andrew Simmons a ?crit?:
> 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 at univ-lyon1.fr
> <mailto:aurelie.siberchicot at 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 at univ-lyon1.fr
> <mailto:aurelie.siberchicot at 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 at r-project.org
> <mailto:R-package-devel at r-project.org> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> <https://stat.ethz.ch/mailman/listinfo/r-package-devel>
>
--
Aur?lie SIBERCHICOT
Ing?nieure en Ing?nierie Logicielle
04 72 44 85 98 - aurelie.siberchicot at 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]]