formalize.package
is useful when you have a set of functions with flat-format documentation that you want to make into a formal package. It creates a bare-bones package with Rsource and Rd documentation ready for RCMD CHECK.formalize.package()
formalize.package( funs=find.funs( where), package, where=1, dir.=,
description.file=, new.index=TRUE, README.goes.first=TRUE)
where
.path
attribute of search pos where
Rdindex
README
, should its documentation file be renamed so that it's found first? See "Package structure details".dir.
. The skeleton will have a DESCRIPTION file, a single Rsource file with name "<formalize.package
is to have your collection of functions as a task called e.g. my.proto.package
, use cd(my.proto.package)
to bring it to the top workspace, and then call formalize.package()
. This will create the formal skeleton in the "my.proto.package" subdirectory of the task directory.
The name of the package is determined by the package
parameter, which will default to the obvious, as above. If package
is not supplied and no sensible default can be deduced, there will be an error message. The gory details are: package
defaults to the name
attribute of search pos where
, without preceding "package:" if any; if this is NULL, package
defaults to the names
attribute of the path
attribute of search pos where
, which will have been set if the thing being packaged is a task.
The mvbutils
and .First
as proto-packages using mlibrary
. Eventually they acquired flat-format documentation-- informal at first, then massaged towards Rd format as CRAN release approached. I then used formalize.package
and (repeatedly!) RCMD CHECK.
Package structure details:
All pre-existing files in the "man" and "R" subdirectories (only) will be removed. No other files or subdirectories are created or removed. You will certainly want to edit the DESCRIPTION file before actual CRAN release.
By default, the Rsource file will only contain functions, but you can include other objects too by naming them in the funs
argument. For functions, only source code will be included; in other words, any attributes except source
are removed before printing. In particular, flat-format documentation in doc
attributes does not go into the Rfile. However, it is used to create the Rd files, bydoc2Rd
.
If any of the Rd files starts with a period (e.g. ".dotty.name"), it will be renamed to "01.dotty.name.Rd" (to avoid some problems with rcmd).
If README.goes.first
is TRUE, any Rd file starting with README
will be renamed 00README...
. This will ensure that the README...function appears first in the "package manual", and top of the list when library(help=mypackage)
is called.cd
, flatdoc
, doc2Rd
, README.mvbutils
, make.usage.section
, make.arguments.section