Which external functions are called in a package?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Which external functions are called in a package?

Hans W Borchers-2
How can I find out which functions of my package A are called within
another package B that depends on, imports, or suggests package A ?
And more specifically, which functions in B are calling functions in A ?

I tried to utilize the *pkgapi* package, but get error messages like

    > map_package("./R/x86_64-pc-linux-gnu-library/3.6/cranlogs")

    Error: <callr_status_error: callr subprocess failed:
        invalid first argument>
    -->
    <callr_remote_error in mget(targets, envir = env,
        mode = "function", inherits = TRUE,  ...:
     invalid first argument>
     in process 22909

(1) What do these error messages mean?

(2) Are there easier ways to get this information?

Thanks in advance. --HW

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Which external functions are called in a package?

Duncan Murdoch-2
On 03/01/2020 12:26 p.m., Hans W Borchers wrote:

> How can I find out which functions of my package A are called within
> another package B that depends on, imports, or suggests package A ?
> And more specifically, which functions in B are calling functions in A ?
>
> I tried to utilize the *pkgapi* package, but get error messages like
>
>      > map_package("./R/x86_64-pc-linux-gnu-library/3.6/cranlogs")
>
>      Error: <callr_status_error: callr subprocess failed:
>          invalid first argument>
>      -->
>      <callr_remote_error in mget(targets, envir = env,
>          mode = "function", inherits = TRUE,  ...:
>       invalid first argument>
>       in process 22909
>
> (1) What do these error messages mean?
>
> (2) Are there easier ways to get this information?

I'm not really familiar with pkgapi, but I believe the first argument is
to the source directory for a package.  It looks as though you are
pointing to the installed copy of it.

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Fwd: Which external functions are called in a package?

Hans W Borchers-2
You are absolutely right. I forgot that there is a difference between
the unpacked and the installed directory of a package. The
documentation of the *pkgapi* package in development is quite scarce
and does not mention the details. Thanks for the tip.

--HW

PS: Still I would like to learn about other approaches for listing
external calls of a package. This must be a general problem for
package developers whose packages are depended on by many other CRAN
packages.


On Fri, 3 Jan 2020 at 20:19, Duncan Murdoch <[hidden email]> wrote:
>
> I'm not really familiar with pkgapi, but I believe the first argument is
> to the source directory for a package.  It looks as though you are
> pointing to the installed copy of it.
>
> Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Which external functions are called in a package?

Jeff Newmiller
If you are so lucky as to have this problem, perhaps you could take a look at the reverse dependencies on your packages' CRAN web page.

On January 3, 2020 1:45:42 PM PST, Hans W Borchers <[hidden email]> wrote:

>You are absolutely right. I forgot that there is a difference between
>the unpacked and the installed directory of a package. The
>documentation of the *pkgapi* package in development is quite scarce
>and does not mention the details. Thanks for the tip.
>
>--HW
>
>PS: Still I would like to learn about other approaches for listing
>external calls of a package. This must be a general problem for
>package developers whose packages are depended on by many other CRAN
>packages.
>
>
>On Fri, 3 Jan 2020 at 20:19, Duncan Murdoch <[hidden email]>
>wrote:
>>
>> I'm not really familiar with pkgapi, but I believe the first argument
>is
>> to the source directory for a package.  It looks as though you are
>> pointing to the installed copy of it.
>>
>> Duncan Murdoch
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Which external functions are called in a package?

Hans W Borchers-2
Jeff, the problem is:
There I see the packages that depend on mine, but not which functions are used
Or maybe I misunderstood your comment.

On Fri, 3 Jan 2020 at 22:49, Jeff Newmiller <[hidden email]> wrote:

>
> If you are so lucky as to have this problem, perhaps you could take a look at the reverse dependencies on your packages' CRAN web page.
>
> On January 3, 2020 1:45:42 PM PST, Hans W Borchers <[hidden email]> wrote:
> >You are absolutely right. I forgot that there is a difference between
> >the unpacked and the installed directory of a package. The
> >documentation of the *pkgapi* package in development is quite scarce
> >and does not mention the details. Thanks for the tip.
> >
> >--HW
> >
> >PS: Still I would like to learn about other approaches for listing
> >external calls of a package. This must be a general problem for
> >package developers whose packages are depended on by many other CRAN
> >packages.
> >
> >
> >On Fri, 3 Jan 2020 at 20:19, Duncan Murdoch <[hidden email]>
> >wrote:
> >>
> >> I'm not really familiar with pkgapi, but I believe the first argument
> >is
> >> to the source directory for a package.  It looks as though you are
> >> pointing to the installed copy of it.
> >>
> >> Duncan Murdoch
> >
> >______________________________________________
> >[hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
> --
> Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Which external functions are called in a package?

Duncan Murdoch-2
In reply to this post by Hans W Borchers-2
On 03/01/2020 4:45 p.m., Hans W Borchers wrote:

> You are absolutely right. I forgot that there is a difference between
> the unpacked and the installed directory of a package. The
> documentation of the *pkgapi* package in development is quite scarce
> and does not mention the details. Thanks for the tip.
>
> --HW
>
> PS: Still I would like to learn about other approaches for listing
> external calls of a package. This must be a general problem for
> package developers whose packages are depended on by many other CRAN
> packages.
>

I've never worried too much about that for my packages.  What matters is
whether the changes I make cause trouble for other packages.  Knowing
the reverse dependencies lets me test all the other packages after
making changes, and if new problems come up, it's usually pretty obvious
which of my functions were being used.

(I use some code I wrote for myself to run the tests with the old and
new version of my package, but I believe there is similar code out there
nowadays to do the comparison.  I'd look in devtools if I was looking
for that.)

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Which external functions are called in a package?

Jeff Newmiller
In reply to this post by Hans W Borchers-2
No, sorry, I misunderstood your question.

a) Read the NAMESPACE file of package B? If they use importFrom that would be specific enough.

b) "Suggests" can refer to usage that does not even appear in the loaded package at all.

c) Try asking in the r-package-devel mailing list?

On January 3, 2020 1:52:51 PM PST, Hans W Borchers <[hidden email]> wrote:

>Jeff, the problem is:
>There I see the packages that depend on mine, but not which functions
>are used
>Or maybe I misunderstood your comment.
>
>On Fri, 3 Jan 2020 at 22:49, Jeff Newmiller <[hidden email]>
>wrote:
>>
>> If you are so lucky as to have this problem, perhaps you could take a
>look at the reverse dependencies on your packages' CRAN web page.
>>
>> On January 3, 2020 1:45:42 PM PST, Hans W Borchers
><[hidden email]> wrote:
>> >You are absolutely right. I forgot that there is a difference
>between
>> >the unpacked and the installed directory of a package. The
>> >documentation of the *pkgapi* package in development is quite scarce
>> >and does not mention the details. Thanks for the tip.
>> >
>> >--HW
>> >
>> >PS: Still I would like to learn about other approaches for listing
>> >external calls of a package. This must be a general problem for
>> >package developers whose packages are depended on by many other CRAN
>> >packages.
>> >
>> >
>> >On Fri, 3 Jan 2020 at 20:19, Duncan Murdoch
><[hidden email]>
>> >wrote:
>> >>
>> >> I'm not really familiar with pkgapi, but I believe the first
>argument
>> >is
>> >> to the source directory for a package.  It looks as though you are
>> >> pointing to the installed copy of it.
>> >>
>> >> Duncan Murdoch
>> >
>> >______________________________________________
>> >[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> >https://stat.ethz.ch/mailman/listinfo/r-help
>> >PLEASE do read the posting guide
>> >http://www.R-project.org/posting-guide.html
>> >and provide commented, minimal, self-contained, reproducible code.
>>
>> --
>> Sent from my phone. Please excuse my brevity.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.