cd
. cdfind
searches for objects through the (attached and unattached) task hierarchy. cdtree
displays the hierarchy structure. cd.change.all.paths
is useful for moving or migrating all or part of the hierarchy to new disk directories. cd.write.mvb.tasks
sets up sourceable text representations of the hierarchy, as a safeguard. cditerate
is the engine that crawls through the hierarchy, underpinning the others; you can write your own functions to be called by cditerate
.cdfind( pattern, from = ., from.text)
cdtree( from = ., from.text = substitute(from), charlim = 90)
cd.change.all.paths( from.text = "0", old.path, new.path)
cd.write.mvb.tasks( from = ., from.text = substitute(from))
cditerate( from.text, what.to.do, so.far = vector("NULL", 0), ...)
cd
); make this 0 to operate on the entire hierarchy.from
if you want to use a character string insteadcdtree
; reduce if unreadable, or change par( cex
)what.to.do
cdfind
returns a list with one element for each object that is found somewhere; each such element is a character vector showing the tasks where the object was found.
cdtree
returns an object of class cdtree
, which is normally printed with indentations to show the hierarchy. You can also plot(cdtree(...))
to see a graphical display.
cd.change.all.paths
and cd.write.mvb.tasks
do not return anything useful.0
as the from
argument.
If you want to automatically crawl through the task hierarchy to do something else, you can write a wrapper function which calls cditerate
, and an inner function to be passed as the what.to.do
argument to cditerate
. The wrapper function will typically be very short; see the code of cdfind
for an example.
The inner function (typically called cdsomething.guts
) must have arguments found
, task.dir
, task.name
, and env
, and may have any other arguments, which will be set according as the ...
argument of cditerate
. found
accumulates the results of previous calls to what.to.do
. Your inner function can augment found
, and should return the (possibly augmented) found
. As for the other parameters: task.dir
is obvious; task.name
is a character(1) giving the full path specifier, e.g. "ROOT/mytask"
; and env
holds the environment into which the task has been (temporarily) loaded. env
allows you to examine the task; for instance, you can check objects in the task by calling ls(env=env)
inside your what.to.do
function. See the code of cdfind.guts
for an example.cdfind( ".First", 0) # probably returns list( .First="ROOT")}
<keyword>utilities</keyword>
Run the code above in your browser using DataLab