cd
ed into the task above your source-task. maintain.packages
must be called before loading the package via library
or require
. The converse, unmaintain.package
, is rarely needed; it's really only meant for when unpackage
doesn't work properly, and you want a "clean slate" task package.# E.g. in your .First, after library( mvbutils), or in a '.First.task' above yr source task
maintain.packages(..., character.only = FALSE)
unmaintain.package( pkg, character.only = FALSE)
character.only
is TRUE. Package names must correspond to subtasks of the current task.character.only
is TRUE.mvbutils
to pre-build your package, then your package must exist as a task in the cd
hierarchy. This means you can in theory cd
to its workspace, but I don't recommend it; and thanks to maintain.packages
, there is no compelling need to have the package/task at the top of the search path.
One piece of cleanup that I recommend, is to move any subtasks of "mypack" one level up in the task hierarchy, and to remove the tasks
object from "Splendid" itself, e.g. via something like:
cd( task.above.splendid)
tasks <- c( tasks, combined.file.paths( tasks[ "Splendid"], ..Splendid$tasks))
# ... combined.file.paths is an imaginary function. Watch out if you've used relative paths!
rm.pkg( tasks, pkg="Splendid")
If do you cd
to a package/task that is already loaded under maintain.packages
, then the loaded version of the package is "frozen" until you cd
back up from the package/task. All fixr
edit operations on objects in the package are redirected to the task version, i.e. the one highest on the search path. pre.install
and then patch.installed
will still work, since they operate on the disk image. When you cd
back up, the task is updated on disk (as cd
always does), and the maintained-package version is reloaded from disk, and all fixr
edits are redirected to the maintained-package version.maintain.packages( mypack)
loads a copy of your source-task package "mypack" (as stored in its ".RData" file) into a variable ..mypack
in the "mvb.session.info" environment. You don't normally need to know this, because normally you'd modify/create functions in the package via fixr
or fixr(..., pkg="mypack")
. However, you can directly modify the contents of ..mypack
. If you do, then remember to use <<-< code="">, e.g. ..mypack$newfun <<- function(="" x)="" whatever<="" code="">, rather than <-
; otherwise, a local copy of ..mypack
will be created in the current task. If that does happen, just rm
it; the local copy and the master copy in "mvb.session.info" both point to the same thing, and modifying one implies modifying the other, so that deleting the local copy won't lose your changes.<->
<-<>
mvbutils.packaging.tools
, fixr
, pre.install
, patch.installed
, unpackage
# In your .First:
library( mvbutils)
maintain.packages( myfirstpack, mysecondpack, mythirdpack)
# or...
live.edit.list <- c( 'myfirstpack', 'mysecondpack', 'mythirdpack')
maintain.packages( live.edit.list, character.only=TRUE)
library( myfirstpack) # etc
Run the code above in your browser using DataLab