package.skeleton {utils} | R Documentation |
package.skeleton
automates some of the setup for a new source
package. It creates directories, saves functions and data to
appropriate places, and creates skeleton help files and
‘Read-and-delete-me’ files describing further steps in packaging.
package.skeleton(name = "anRpackage", list, environment = .GlobalEnv, path = ".", force = FALSE)
name |
character string: the directory name for your package. |
list |
character vector naming the R objects to put in the package. |
environment |
if list is omitted, the contents of this
environment are packaged. |
path |
path to put the package directory in. |
force |
If FALSE will not overwrite an existing directory. |
The package sources are placed in subdirectory name
of path
.
This tries to create filenames valid for all OSes known to run R.
Invalid characters are replaced by _
, invalid names are
preceded by zz
, and finally the converted names are made
unique by make.unique(sep = "_")
. This can be done for
code and help files but not data files (which are looked for by name).
Also, the code and help files should have names starting with an ASCII
letter or digit, and this is checked and if necessary z
prepended.
When you are done, delete the ‘Read-and-delete-me’ files, as they should not be distributed.
used for its side-effects.
Read the Writing R Extensions manual for more details.
Once you have created a source package you need to install it:
see the R Installation and Administration manual,
INSTALL
and install.packages
.
## two functions and two "data sets" : f <- function(x,y) x+y g <- function(x,y) x-y d <- data.frame(a=1, b=2) e <- rnorm(1000) package.skeleton(list=c("f","g","d","e"), name="mypkg")