flow_view_source_calls {flow} | R Documentation |
Draw diagram of source dependencies
Description
Assuming a project where files source each other, draw their dependency graph.
Usage
flow_view_source_calls(
paths = ".",
recursive = TRUE,
basename = TRUE,
extension = FALSE,
smart = TRUE,
out = NULL
)
Arguments
paths |
Paths to scripts or folders containing scripts By default explores the working directory. |
recursive |
Passed to |
basename |
Whether to display only the base name of the script |
extension |
Whether to display the extension |
smart |
Whether to parse complex source calls for strings that look like script and
match those to files found in |
out |
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. |
Details
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.
Value
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.