Visualizing Code Flow in R

Let's say I have a package with functions foo1, foo2, foo3, ...foo30. I also have a script. Maybe the script is in a file 'ScriptR1' and contains:

x = 1
y = 2
foo1(x, y)

foo1 calls foo2, then foo3. foo3 may call foo9.

I'd like a tool or function that when given the input 'ScriptR1' would create something like a flow chart or visualization (or even text) mapping the function calls in ScriptR1.

ScriptR1
foo1
foo2
foo3
foo9

I'm pretty flexible and realize this is probably not easy. I'm not really interested in base function calls meaning 'apply' and '+' could be eliminated. Ideally I could supply the package name(s) of the functions I want listed.

Does this exist? Thanks.

It looks like the flow package does what you're describing.

1 Like