View source: R/utils-get_code_dependency.R
get_code_dependency | R Documentation |
Extract subset of code required to reproduce specific object(s), including code producing side-effects.
get_code_dependency(code, names, check_names = TRUE)
code |
|
names |
|
check_names |
|
Given a character vector with code, this function will extract the part of the code responsible for creating
the variables specified by names
.
This includes the final call that creates the variable(s) in question as well as all parent calls,
i.e. calls that create variables used in the final call and their parents, etc.
Also included are calls that create side-effects like establishing connections.
It is assumed that object dependency is established by using three assignment operators: <-
, =
, and ->
.
Other assignment methods (assign
, <<-
) or non-standard-evaluation methods are not supported.
Side-effects are not detected automatically and must be marked in the code.
Add # @linksto object
at the end of a line where a side-effect occurs to specify that this line is required
to reproduce a variable called object
.
Character vector, a subset of code
.
Note that subsetting is actually done on the calls code
, not necessarily on the elements of the vector.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.