Learn R Programming

mvbutils (version 2.5.101)

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. Seecd.
  • 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 byhelp. 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. Seemvbutils.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. Seemlazy.
  • Miscellaneous goodies: local/nested functions (mlocal), display of what-calls-what (foodweb), multiple replacement (multirep), better handling ofPOSIXtespecially 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.

Arguments

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.searchis the directory R{} started 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.help
  • fix.listkeeps track of objects being edited viafixr
  • session.start.timeis the value ofSys.time()whenmvbutilswas loaded
  • source.listis used bysource.mvbto allow nesting of sources
  • r.window.handleis used by thehandypackage (Windows only)
  • partial.namespacesis used to alleviate difficulties with unloadable data files-- seemvbutils.packaging.tools
  • things whose name starts with ".." are environments used in live-editing packages
  • maintained.packagesis a list of the above