mvbutils-package: How to use the mvbutils package
Description
Package mvbutils is a collection of utilities offering the following main features:
- Hierarchical organization of projects (tasks) and sub-tasks, allowing switching within a single R{} session, searching and moving objects through the hierarchy, objects in ancestor tasks always visible from child (sub)tasks, etc. See
cd
. - Improved function, text, and object editing facilities, interfacing with whichever text editor you prefer. The R{} command line is not frozen while editing, and you can have multiple edit windows open. Scriptlets that generate general-purpose objects can also be maintained this way. Function documentation can be stored as plain text after the function definition, and will be found by
help
. There is also a complete automatic text-format backup system for functions & text. Seefixr
. - Automated package construction, including production of Rd-format from plain text documentation. Packages can be edited & updated while loaded, without needing to quit/rebuild/reinstall. See
mvbutils.packaging.tools
. - "Lazy loading" for individual objects, allowing fast and transparent access to collections of biggish objects where only a few objects are used at a time. See
mlazy
. - Miscellaneous goodies: local/nested functions (
mlocal
), display of what-calls-what (foodweb
), multiple replacement (multirep
), better handling ofPOSIXt
especially in matrices & data.frames, numerous lower-level lower-level utility functions and operators (mvbutils.utils
,mvbutils.operators
,extract.named
,mcut
,search.for.regexpr
,strip.missing
,Hours
).
To get the full features of the mvbutils package-- in particular, the project organization-- you need to start R{} in 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 or ".Rprofile" file, to be called automatically when you start R{}. However, many features (including support for the debug package) will work even if you don't follow this suggestion.
The remaining sections of this document cover details that most users don't know about; there's no need to read them when you are just starting out with mvbutils
.Housekeeping info
On loading, the mvbutils package 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 R{} session 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.search
is the directory R{} started in (your ROOT task)..Path
shows the currently-attached part of the task hierarchy.base.xxx
is the original copy of an overwritten system function, e.g.help
fix.list
keeps track of objects being edited viafixr
session.start.time
is the value ofSys.time()
whenmvbutils
was loadedsource.list
is used bysource.mvb
to allow nesting of sourcesr.window.handle
is used by thehandypackage (Windows only)partial.namespaces
is used to alleviate difficulties with unloadable data files-- seemvbutils.packaging.tools
- things whose name starts with ".." are environments used in live-editing packages
maintained.packages
is a list of the above