I'm excited to announce that foodwebr 1.0.0 is now available on CRAN! The package makes it simple to understand and visualize function dependencies in R codebases.

What is foodwebr?

foodwebr helps developers and analysts explore code relationships by generating function dependency graphs. It shows which functions call other functions, making it easier to understand code structure and relationships at a glance.

Installation

Install directly from CRAN:

install.packages("foodwebr")

Quick Example

library(foodwebr)

# Define some interconnected functions
f <- function() 1
g <- function() f()
h <- function() { f(); g() }

# Generate the foodweb
fw <- foodweb()

fw
#> # A `foodweb`: 3 vertices and 3 edges
#> digraph 'foodweb' {
#>   f()
#>   g() -> { f() }
#>   h() -> { f(), g() }
#> }

plot(fw)

Key Features

  • Easy visualization: Generate function dependency graphs with minimal code
  • Flexible filtering: Focus on specific function relationships or view the entire codebase
  • Package analysis: Explore dependencies in other packages, not just your own code
  • Integration: Works with tidygraph for advanced graph analysis and graphviz for enhanced visualization

Filtering Options

Target specific functions or view the full picture:

# Show dependencies centered on a specific function
foodweb(FUN = g)

# Include all functions, even unconnected ones
foodweb(FUN = g, filter = FALSE)

Learn More

Check out the documentation for more examples and advanced usage.

If you find foodwebr useful, consider starring the GitHub repository or filing issues and feature requests there.