Visualizing How Functions Connect Within an R Package

Hello RStudio Community!

I have done some searching on the web and was unable to find a package that does what I am looking for and wanted to see if anyone here knows of a project/process that does this.

If I have a package is there a process out there that lets me give the package as an input and the output would be a diagram of all the internal and external functions and how they are called from one another?

I have been researching the {targets} package and love the diagrams it can generate showing the overall process of a project. That has me starting to think if there is a way to visualize the way my package is structured and what functions depend on other functions.

Thanks in advance! :grin:

1 Like

{ScriptMapR} purports to do this, although it uses Cytoscape as an external rendering engine. At a glance ,Cytoscape appears unnecessarily elaborate and one of the many R graph packages should provide a substitute for exploiting the node-edge lists generated by ScriptMapR.

Probably simpler is {CodeDepends}

1 Like

In a R-hub blog post I used the pkgapi package by @Gabor, together with visNetwork.

4 Likes

Thanks for sharing these packages! I have not seen any of them before. {ScriptMapR} has problems installing in my work environment so I couldnt test that, from what I saw that package would produce some beautiful displays for scripts. I didn't see anything about a package as a whole.

After installing a few packages from bioconductor, I was able to produce some static plot which were a bit hard to read. However, while scrolling the issues on GitHub I found a reference to a package that does exactly what I am looking for, {pkgnet}! This package will even write out a vignette for my internal packages at work, thanks for sharing all of these packages with me! :smiley:

That was an amazing post @maelle! I had a blast modifying the code and playing around with {visNetwork} for the first time! I have stumbled upon {pkgnet} which builds wonderful reports based off the current project and creates plots very similar to what you have shared in your post!

Thank you so much for sharing with me!

1 Like

Nice, thank you for sharing about {pkgnet}!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.