Converts an existing source package into a task package. A subdirectory with the package name will be created under the current working directory, and will be populated with a ".RData" file and various other files/directories from the source package. All Rd files will be turned into flat-format help in the ".RData", either attached to functions or as stand-alone "*.doc" text objects, as per help2flatdoc
. The subdirectory will also be made into a task, i.e. it will be added to the "tasks" vector in the current workspace that cd
uses to keep track of the task hierarchy.
unpackage(spath, force = FALSE)
where to find the source package
if TRUE, overwrite any previous contents of task package without prompting.
The NAMESPACE file won't be copied; instead, it will be auto-generated by pre.install
. Therefore, some features of the original NAMESPACE may be lost. You can either copy the NAMESPACE manually (in which case, you'll need to maintain it by hand), or write a "pre.install.hook.MYPACK" function.
The DESCRIPTION file becomes a character vector called e.g. <mypack>.DESCRIPTION
, of class "cat" (see as.cat
).
Functions in the ".RData" may be saved with extra attributes, in particular "doc" (deduced from a dot-Rd file) but perhaps other things too that they acquire after the package code is source
d. Attributes that are character vector will acquire class "docattr", so that they won't be fully displayed during default printing of the function; to see them, use e.g. as.cat( attr( myfun, "myatt"))
or unclass( attr( myfun, "myatt"))
or, if you are using the atease package, just as.cat( myfun@myatt)
. Editing the function with fixr
will display the character attributes in full.
Any environment objects found in the package's environment (its namespace environment) will be dropped from the ".RData" file, with a warning; this is to avoid dramas on reloading.