track {trackObjs} | R Documentation |
Functions to start and stop tracking objects, remove them, load objects from RData files, and manage cached and saved copies of objects.
track(expr, pos = 1, envir = as.environment(pos), list = NULL, pattern = NULL, glob = NULL, all = FALSE) untrack(expr, pos = 1, envir = as.environment(pos), list = NULL, pattern = NULL, glob = NULL, all = FALSE, keep.in.db = FALSE) track.remove(expr, pos = 1, envir = as.environment(pos), list = NULL, pattern = NULL, glob = NULL, all = FALSE) track.save(expr, pos = 1, envir = as.environment(pos), list = NULL, pattern = NULL, glob = NULL, all = missing(expr)) track.resave(expr, pos = 1, envir = as.environment(pos), list = NULL, pattern = NULL, glob = NULL, all = missing(expr)) track.flush(expr, pos = 1, envir = as.environment(pos), list = NULL, pattern = NULL, glob = NULL, all = missing(expr)) track.forget(expr, pos = 1, envir = as.environment(pos), list = NULL, pattern = NULL, glob = NULL, all = FALSE) track.load(files, pos = 1, envir = as.environment(pos), list = NULL, pattern = NULL, glob = NULL, cache = FALSE, clobber = FALSE, time.of.file = TRUE, warn = TRUE)
expr |
An unquoted variable name |
pos |
The search path position of the environment being tracked (default is 1 for the global environment) |
envir |
The environment being tracked. This is an alternate way
(to the use of pos= )
of specifying the environment being tracked, but should be rarely needed. |
list |
A character vector of variable names to operate upon |
pattern |
A regular expression specifying variable names to operate upon |
glob |
A regular expression specifying variable names to operate upon |
all |
If TRUE , operate upon all elegible variables |
keep.in.db |
If TRUE , the variable is left in the
tracking database, though the link to it is broken (it becomes masked) |
files |
A vector of names of RData files (any file saved by save() ) |
cache |
TRUE or FALSE indicating whether to keep the tracked
object cached in memory |
clobber |
TRUE or FALSE indicating whether to
overwrite existing objects of the same name |
time.of.file |
If TRUE , use the access times on the file
to populate the access time fields in the tracking summary. |
warn |
If TRUE , issue warnings about object not acted upon. |
These functions are executed for their side effects:
track
: start tracking the specified variables
untrack
: stop tracking the specified variables, leaving the object in envir
so that it can
still be used. If keep.in.db=TRUE
, the variable is left
in the tracking environment (but is masked), if
keep.in.db=FALSE
(the default),
all trace of the variable is completely removed from the tracking
environment.
track.remove
: completely remove all
traces of a tracked variable
track.save
: write unsaved variables to disk
track.flush
: write unsaved variables to disk, and remove from memory
track.forget
: delete cached
versions without saving to file (file version will be retrieved next
time the variable is accessed)
track.restart
: reload variable
values from disk (can forget all cached vars, remove no-longer existing tracked vars)
track.load
: load variables from a
saved RData file into the tracking session - if list
is
supplied, only these variables are loaded in. Already existing
variables will be skipped and not overwritten unless clobber=TRUE
is supplied.
The value returned from these functions is invisible and typically contains the names of objects acted upon.
track: |
a character vector containing the names of objects added to the tracking environment |
untrack, track.remove, track.save, track.flush, track.forget, track.restart: |
a character vector containing the names of objects in the tracking environment that were acted upon |
track.load: |
a list with two components:
|
Tony Plate <tplate@acm.org>
Overview and design of the trackObjs
package.
library(trackObjs) unlink("tmp1", recursive=TRUE) track.start("tmp1") track(x <- 33) X <- array(1:24, dim=2:4) track(X) track(Y <- list(a=1:3,b=2)) X[2] <- -1 track.summary(time=0, access=1, size=FALSE) y1 <- 2 y2 <- 3 track(all=TRUE) z1 <- 4 z2 <- 5 z3 <- 6 untracked() track(list=c("z1", "z3")) untracked() track.summary(time=0, access=1, size=FALSE) ls(all=TRUE) track.stop() ls(all=TRUE) a <- 7 b <- 8 save(list=c("a", "b"), file="ab.rda") remove(list=c("a", "b")) track.start("tmp1") track.summary(time=0, access=1, size=FALSE) track.load("ab.rda") track.summary(time=0, access=1, size=FALSE) track.status() track.stop() unlink("tmp1", recursive=TRUE)