[R-pkg-devel] Analysing namespace reverse dependencies

Roger Bivand Roger@B|v@nd @end|ng |rom nhh@no
Sun Mar 10 20:45:30 CET 2019


On Sat, 9 Mar 2019, Gábor Csárdi wrote:

> https://github.com/r-lib/pkgapi has map_package() which will list all
> the functions of a package, where they were defined, and also all
> function calls, internal ones and calls to external packages as well:
>
> map <- pkgapi::map_package("~/works/processx")
> names(map)
> #> [1] "name"    "exports" "defs"    "calls"
>
> head(map$calls, 3)
> #>               file        from                 to type
> #> 1 R/aaassertthat.R assert_that base::parent.frame call
> #> 2 R/aaassertthat.R assert_that   processx::see_if call
> #> 3 R/aaassertthat.R assert_that       base::return call
> #>   line1 line2 col1 col2          str
> #> 1     2     2   36   47 parent.frame
> #> 2     3     3   10   15       see_if
> #> 3     4     4   12   17       return

Thanks, this gives a grepable character vector in map$calls$to from which 
I can search for "A::" among the namespaces listed. The function returns 
S3 methods (I think - some are written in full in the "B" code). I'm not 
sure about S4 methods or class definitions. However, I'm much further 
forward, again, thanks!

Roger



>
> Because of the dynamic nature of the language, some false negatives,
> and maybe even false positives might happen.
>
> Gabor
>
> On Sat, Mar 9, 2019 at 2:06 PM Roger Bivand <Roger.Bivand using nhh.no> wrote:
>>
>> Hi,
>>
>> Is anyone aware of tools permitting the listing of functions in the
>> namespace of package A used by package B when package B declares that it
>> depends on A, suggests A, or imports(A) without specifying the functions
>> from A that B is using? If B imports functions from A, and uses
>> importsFrom() in its NAMESPACE, the information can be recovered by
>> inspecting its NAMESPACE file (assuming that the entries are correct), but
>> not otherwise.
>>
>> Grateful for any pointers,
>>
>> Roger
>>
>> --
>> Roger Bivand
>> Department of Economics, Norwegian School of Economics,
>> Helleveien 30, N-5045 Bergen, Norway.
>> voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
>> https://orcid.org/0000-0003-2392-6140
>> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>>
>> ______________________________________________
>> R-package-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en


More information about the R-package-devel mailing list