package.skeleton
Create a Skeleton for a New Source Package

### Description

Creates a skeleton for a new package based on existing functions

### Usage

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

### Arguments

name | a character string specifying the name of package to be created.
list | a character vector naming the objects in the new package. If missing, the character vector that lists the names of objects contained in environment is used.
environment | an environment to find objects. The default is .GlobalEnv.
path | a character string specifying the name of parent directory where the new package skeleton is created.
force | a logical value. If TRUE, the package skeleton is forced to be created even it exists. If FALSE (the default), the function is stopped with a message.
code_files | a character vector specifying the code file names. These files can be parsed and evaluated through sys.source, and copied to code directory of package.

### Details

- When list is not supplied, and code_files contains at least one file, the following sequence occurs:
  1. The environment is replaced with a new hashed environment created through new.env().
  2. The files in code_files are parsed and evaluated in this new environment, and the objects list is also retrieved from this environment.
  3. The package directory specified by name is created under the parent directory specified by path.
  4. The code, documentation, and data directories named, respectively, R, man and data are created.
  5. The files DESCRIPTION, NAMESPACE and Read-and-delete-me are created at the package root directory.

- When code_files is not supplied, the following occurs:
  1. All internal objects are dumped (using dump()) to the file pkgname-internal.R under the directory R.
  2. The function objects specified in list are dumped (using dump()) to the directory R. Each function object corresponds to one .R file, which has the file name object name.R.
  3. The non-function objects specified by list are saved (using save()) to the directory data. Each object corresponds to one .rda file, which has the file name object name.rda.
- When code_files is supplied, the following occurs:
  1. The files specified in code_files are copied to the directory R.
  2. The help files are created in the directory man.
  3. The file pkgname-internal.Rd might be created for internal objects.
  4. The file pkgname-package.Rd is created for the package through promptPackage().
  5. The files object name.Rd are created for each object specified in list through prompt().

package.skeleton had the argument namespace=TRUE until Spotfire Enterprise Runtime for R version 2.5. The namespace argument was removed to match the removal of that argument in Open Source R 3.0.0. Now, package.skeleton always writes the file NAMESPACE in the package and never writes a help file for "for-internal-use-only" functions.
After you create a source package, you must install it.
Value
Returns nothing; creates a package skeleton in specified directory.
References
INSTALL. R Installation and Administration. R Project.
install.packages. R Installation and Administration. R Project.
Writing R Extensions. R Project.
See Also
ls, sys.source, dump, save, file.copy, promptPackage, prompt
Examples

    ## Not run:
    # Running these examples will create 2 source package directories
    # in your current working directory.
    fun1 <- function(x) { x^3+ 2*x+ 10}
    fun2 <- function(y) { sin(y) + fun1(y)}
    data1 <- ts(sin(1:100), freq=12, start=2014.25)
    data2 <- matrix(cos(1:20), nrow = 4)
    package.skeleton(name = "Mypack", list = c("fun1", "fun2", "data1", "data2"))
    package.skeleton(name = "Mypack1",
        list = c("fun1", "fun2", "data1", "data2"), force = TRUE)

    ## End(Not run)

Package utils version 6.1.5-18
Package Index