Skip to content

[R-pkg-devel] why can't we importFrom 'methods' ?

5 messages · Brian G. Peterson, Martin Maechler, Duncan Murdoch +2 more

#
newer versions of R require importFrom for functions from 'stats',
'graphics' and many other packages that used to be assumed to be on the
search path and thus available.

'methods' continues to have seemingly different treatment.

If you try to use importFrom to import a single function (in this case
'hasArg') from methods, you receive an ERROR from R CMD check

    Namespace dependency not required : 'methods'

but without the importFrom, you see a number of NOTE's

    no visible global function definition for 'hasArg'

I don't want to import all of 'methods', as I only need one function.

What am I doing wrong?

Regards,

Brian
#
> newer versions of R require importFrom for functions from
    > 'stats', 'graphics' and many other packages that used to
    > be assumed to be on the search path and thus available.

    > 'methods' continues to have seemingly different treatment.

    > If you try to use importFrom to import a single function
    > (in this case 'hasArg') from methods, you receive an ERROR
    > from R CMD check

    >     Namespace dependency not required : 'methods'

    > but without the importFrom, you see a number of NOTE's

    >     no visible global function definition for 'hasArg'

    > I don't want to import all of 'methods', as I only need
    > one function.

Many many good(*) packages import from methods, from R base, it
is "of course" only 'stats4';
from packages I maintain:  Matrix, Rmpfr, copula (at least)
then many hundreds of high quality bioconductor packages.


    > What am I doing wrong?

Did you add it to the DESCRIPTION to the 'Imports:' ?

    > Regards,

    > Brian

    > -- 
    > Brian G. Peterson http://braverock.com/brian/ Ph:
    > 773-459-4973 IM: bgpbraverock

    > ______________________________________________
    > R-package-devel at r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-package-devel
#
On 17/05/2018 11:51 AM, Brian G. Peterson wrote:
That message usually means that you didn't list 'methods' in the Imports 
clause in DESCRIPTION.

Duncan Murdoch
#
The confusion may stem from (the probably inadvertent) feature that the quality control tools
do not raise alarm if there are imports from "stats" and "graphics" even if they are not in "Imports:'.

Georgi Boshnakov

-----Original Message-----
From: R-package-devel [mailto:r-package-devel-bounces at r-project.org] On Behalf Of Duncan Murdoch
Sent: 17 May 2018 16:59
To: Brian G. Peterson; R Package Development
Subject: Re: [R-pkg-devel] why can't we importFrom 'methods' ?
On 17/05/2018 11:51 AM, Brian G. Peterson wrote:
That message usually means that you didn't list 'methods' in the Imports 
clause in DESCRIPTION.

Duncan Murdoch
______________________________________________
R-package-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel
#
On 05/17/2018 11:59 AM, Duncan Murdoch wrote:
Is there a better way of formulating the message?

   Packages used in the NAMESPACE file must also be in the Imports: or 
Depends: field of the DESCRIPTION file; missing packages : 'methods'

   Package(s) not present in Imports: or Depends: of DESCRIPTION :
       'methods'

    ... ?

Martin Morgan
This email message may contain legally privileged and/or...{{dropped:2}}