Assuming a project where files source each other, draw their dependency graph.

  paths = ".",
  recursive = TRUE,
  basename = TRUE,
  extension = FALSE,
  smart = TRUE,
  out = NULL



Paths to scripts or folders containing scripts By default explores the working directory.


Passed to list.files() when paths contains directories


Whether to display only the base name of the script


Whether to display the extension


Whether to parse complex source calls for strings that look like script and match those to files found in paths


a path to save the diagram to. Special values "html", "htm", "png", "pdf", "jpg" and "jpeg" can be used to export the object to a temp file of the relevant format and open it, if a regular path is used the format will be guessed from the extension.


flow_view_source_calls() returns a "flow_diagram" object by default, and the output path invisibly if out is not NULL (called for side effects). flow_run() returns the output of the wrapped call.


This evaluates the file argument of source in the global environment, when this fails, as it might with constructs like for (file in files) source(file) the unevaluated argument is printed instead between backticks. Since this messes up the relationships in the graph, an warning is thus issued. In a case like source(file.path(my_dir, "foo.R") defining my_dir will be enough to solve the issue. In the latter case, if smart is TRUE, the function will check in all the paths in scope if any script is named "foo.R" and will consider it if a single fitting candidate is found.