В Sat, 24 Feb 2024 03:08:26 +0000 Leo Mada via R-help <r-help@r-project.org> пишет:
> Are there any tools to extract the function names called by > reverse-dependencies? For well-behaved packages that declare their dependencies correctly, parsing the NAMESPACE for importFrom() and import() calls should give you the explicit imports. (What if the package imports the whole dependency? The safe assumption is that all functions are used, but it comes with false positives. You could also walk the package code looking for function names that may belong to the imported package, but that may involve both false positives and false negatives.) For the rest of the imports and uses of weak dependencies, you'll have to walk the package code looking for the uses of the `::` operator. See how R CMD check walks the package code in functions tools:::.check_packages_used and codetools::checkUsage. A less-well-behaved package can always load a namespace during runtime and choose the functions to call depending on the phase of the moon or weather on Jupiter. For these, like for the halting problem, there's no general solution: the package could be written to say, "if Leonard's function says I'm about to call foo::bar, I won't do it, otherwise I will". -- Best regards, Ivan ______________________________________________ R-help@r-project.org 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.