README.mvbutils: How to use mvbutils
Description
For how to use mvbutils, see the DETAILS section below.Details
mvbutils is a collection of utilities offering the following main features:
- Hierarchical organization of projects and sub-projects, allowing switching within a singleRsession, searching and moving objects through the hierarchy, objects in ancestor projects always visible from child (sub)projects, etc. See
cd. - Improved function editing facilities, interfacing with whichever text editor you prefer. TheRcommand line is not frozen while editing, and you can have multiple edit windows open. There is also a complete automatic text backup system, with (as a side-effect) the ability to sort functions by date. See
fixr. - "Lazy loading" for individual objects, allowing fast & efficient access to collections of biggish objects where only a few objects are used at a time. See
mlazy. - Support for flat-format (plain-text) documentation, stored along with a function and editable at the same time, and viewable through normal
help. Automatic conversion to Rd format is available if certain rules are followed. Seeflatdoc. - Support for nesting of
sourcecalls, and for interspersingRcode and data in the same file. Seesource.mvb. - Support for easy macro-like functions which act in their caller's environment (see also RNews 1/3), and for "dynamically scoped" functions. See
mlocalanddo.in.envir. - Graphical display of which functions call which other functions. See
foodweb.
There are also numerous lower-level utility functions and operators: see ?"mvbutils-utils" and ?"mvbutils-operators".
To get the full features of mvbutils (in particular, the project organization), you need to start Rin the same directory every time (your "ROOT task"), and then switch to whichever project from inside R; see cd. Various options always need to be set to make fixr and the debug package work the way you want, so one advantage of the start-in-the-same directory-approach is that you can keep all your project-independent options(), library loads, etc., in a single .First function, called automatically when you start R. However, most features (including support for the debug package) will probably work even if you don't follow this suggestion.
On loading, mvbutils creates a new environment in the search path, called mvb.session.info, which stores some housekeeping information. mvb.session.info is never written to disk, and disappears when the Rsession finishes. [For Splus users: mvb.session.info is similar to frame 0.] You should never change anything in mvb.session.info by hand, but it is sometimes useful to look at some of the variables there:
.First.top.searchis the directoryRstarted in (your ROOT task)..Pathshows the currently-attached part of the task hierarchy.base.xxxis the original copy of an overwritten system function, e.g.helpfix.listkeeps track of functions being edited viafixrsession.start.timeis the value ofSys.time()whenmvbutilswas loadedsource.listis used bysource.mvbto allow nesting of sourcestraceesis used by thedebugpackage to store debugging informationr.window.handleis used by thehandypackage (Windows only)
See Also
cd, fixr, mlazy, flatdoc, dochelp, formalize.package, source.mvb, mlocal, do.in.envir, foodweb, clip, mvbutils-operators, mvbutils-utils, package debug