package.skeleton            package:utils            R Documentation

Create a Skeleton for a New Source Package

Description:

     '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 a
     'Read-and-delete-me' file describing further steps in packaging.

Usage:

     package.skeleton(name = "anRpackage", list,
                      environment = .GlobalEnv,
                      path = ".", force = FALSE, namespace = FALSE,
                      code_files = character())

Arguments:

    name: character string: the directory name for your package.

    list: character vector naming the R objects to put in the package. 
          Defaults to the non-hidden files in 'environment' (those
          whose name does not start with '.').

environment: an environment where objects are looked for (unless
          'code_files' is used).

    path: path to put the package directory in.

   force: If 'FALSE' will not overwrite an existing directory.

namespace: a logical indicating whether to add a name space for the
          package.

code_files: a character vector with the paths to R code files to build
          the package around.  Used only if 'list' is missing.

Details:

     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.

     If 'code_files' are given, these are copied over to the package
     code directory (so that non-function code objects are not
     converted to data sets), and the corresponding help files are
     generated.

     When you are done, delete the 'Read-and-delete-me' file, as it
     should not be distributed.

Value:

     Used for its side-effects.

References:

     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'.

See Also:

     'prompt'

Examples:

     require(stats)
     ## 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")

