README.mvbutils {mvbutils} | R Documentation |
For how to use mvbutils
, see the DETAILS section below.
README.mvbutils()
mvbutils
is a collection of utilities offering the following main features:
cd
.
fixr
.
mlazy
.
help
. Automatic conversion to Rd format is available if certain rules are followed. See flatdoc
.
source
calls, and for interspersing R code and data in the same file. See source.mvb
.
mlocal
and do.in.envir
.
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 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, 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 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 functions being edited via fixr
session.start.time
is the value of Sys.time()
when mvbutils
was loaded
source.list
is used by source.mvb
to allow nesting of sources
tracees
is used by the debug package to store debugging information
r.window.handle
is used by the handy package (Windows only)
On loading, the present version of mvbutils
overwrites a few system functions: library
, help
, and savehistory
, and loadhistory
. The modifications should have [almost] no side-effects, and/but I hope to be able to avoid them altogether in future versions of R. Briefly:
library
is modified so that its default pos
argument becomes a call to lib.pos()
. This means that packages get attached just below ROOT rather than always in position 2 (needed by cd
);
help
is modified so that, if system help
can't find help for a simple object (not a method or package), it will look for the doc
attribute of that object (if any) and display it in a pager using dochelp
.
- savehistory
and loadhistory
are modified so that they use the R_HISTFILE
environment variable if it set. This can be set dynamically during an R session using Sys.putenv
. Standard R behaviour is to respect R_HISTFILE
iff it is set before the R session starts. Note that, by default, cd
will on first use set R_HISTFILE
to what it thinks is the ROOT task, so that same the history file will be used throughout the session; see cd
if you want to change this.
If you are certain that you don't want these replacements, set options(mvbutils.replacements=FALSE)
before loading mvbutils
. However, this will prevent cd
and the flat-documentation help from working properly.
For ESS users: I'm not an Emacs user and so haven't tried ESS with the mvbutils package myself, but a read-through of the ESS documentation suggests that a couple of ESS variables may need changing to get the two working optimally. Please check the ESS documentation for further details on these points. I will update this helpfile when/if I receive more feedback on what works.
cd
changes the search list, so you may need to alter "ess-change-sp-regex" in ESS.
cd
also changes the prompt, so you may need to alter "inferior-ess-prompt". Prompts have the form WORD1/WORD2/.../WORDn> where WORDx is a letter followed by one or more letters, underscores, periods, or digits.
move
can add/remove objects in workspaces other than the top one, so if ESS relies on stored internal summaries of "what's where", these may need updating.
Display bugs: if you have a buggy Unix display where readline()
always returns the cursor to the start of the line, overwriting any prompt, then try options( cd.extra.CR=TRUE)
.
Mark Bravington
cd
, fixr
, mlazy
, flatdoc
, dochelp
, formalize.package
, source.mvb
, mlocal
, do.in.envir
, foodweb
, clip
, mvbutils-operators
, mvbutils-utils
, package debug