updatingScript {CodeDepends} | R Documentation |
Create a Script object that re-reads the original file as needed
Description
This function reads the code in a particular document
and creates a Script-class
object
to represent the code and allow us to do analysis
on that code.
Unlike readScript
, this object
continues to read any updates to the original code file
when we use this Script
object in computations.
This allows us to modify the original source interactively
and concurrently with our R session and still have the
script remain up-to-date with that code.
Usage
updatingScript(doc, ...)
Arguments
doc |
the name/location of the document containing the R code |
... |
any additional arguments, passed to |
Details
This uses a reference class to update state across calls.
Value
an object of class DynScript
Author(s)
Duncan Temple Lang
See Also
Examples
fil <- file.path(tempdir(), "foo.R")
cat("x = 1:10\ny = 3*x + 7 + rnorm(length(x))\n", file = fil)
sc = updatingScript(fil)
as(sc, "Script")
con = file(fil, "at")
cat("z = x + y", file = con)
close(con)
as(sc, "Script")
[Package CodeDepends version 0.6.6 Index]