createPackage: Create a Package Directory from a Template

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/packages.R

Description

Create a package directory from a template, with symbol-value substitution

Usage

1
createPackage(pkgname, destinationDir, originDir, symbolValues, unlink=FALSE, quiet=FALSE)

Arguments

pkgname

Character. The name of the package to be written.

destinationDir

Character. The path to a directory where the package is to be written.

originDir

Character. The path to a directory that contains the template package. Usually, this will contain a file named DESCRIPTION, and subdirectories R, man, data. In all files and filenames, symbols will be replaced by their respective values, see the parameter symbolValues.

symbolValues

Named list of character strings. The symbol-to-value mapping. See copySubstitute for details.

unlink

Logical. If TRUE, and destinationDir already contains a file or directory with the name pkgname, try to unlink (remove) it.

quiet

Logical. If TRUE, do not print information messages.

Details

The intended use of this function is for the automated mass production of data packages, such as the microarray annotation, CDF, and probe sequence packages.

No syntactic or other checking of the package is performed. For this, use R CMD check.

The symbols @PKGNAME@ and @DATE@ are automatically defined with the values of pkgname and date(), respectively.

Value

The function returns a list with one element pkgdir: the path to the package.

Author(s)

Wolfgang Huber http://www.dkfz.de/mga/whuber

See Also

copySubstitute, the reference manual Writing R extensions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  sym  = list(AUTHOR = "Hesiod", VERSION = "1.0",
         TITLE = "the nine muses",
         FORMAT = "Character vector containg the names of the 9 muses.")

  res  = createPackage("muses",
           destinationDir = tempdir(),
           originDir      = system.file("Code", package="Biobase"),
           symbolValues   = sym,
           unlink = TRUE, quiet = FALSE)

  muses = c("Calliope", "Clio", "Erato", "Euterpe", "Melpomene",
            "Polyhymnia", "Terpsichore", "Thalia", "Urania")

  dir.create(file.path(res$pkgdir, "data"))

  save(muses, file = file.path(res$pkgdir, "data", "muses.rda"))

  res$pkgdir

Biobase documentation built on Nov. 8, 2020, 6:52 p.m.