\HeaderA{package.skeleton}{Create a Skeleton for a New Source Package}{package.skeleton}
\keyword{file}{package.skeleton}
\keyword{utilities}{package.skeleton}
\begin{Description}\relax
\code{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
\file{Read-and-delete-me} file describing further steps in packaging.
\end{Description}
\begin{Usage}
\begin{verbatim}
package.skeleton(name = "anRpackage", list, environment = .GlobalEnv,
                 path = ".", force = FALSE, namespace = FALSE,
                 code_files = character())
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{name}] character string: the directory name for your package.
\item[\code{list}] character vector naming the \R{} objects to put in the
package.
\item[\code{environment}] if \code{list} is omitted and \code{code\_files} is
empty, the contents of this environment are packaged.
\item[\code{path}] path to put the package directory in.
\item[\code{force}] If \code{FALSE} will not overwrite an existing
directory.
\item[\code{namespace}] a logical indicating whether to add a name space for
the package.
\item[\code{code\_files}] a character vector with the paths to R code files to
build the package around.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The package sources are placed in subdirectory \code{name} of
\code{path}.

This tries to create filenames valid for all OSes known to run R.
Invalid characters are replaced by \samp{\_}, invalid names are
preceded by \samp{zz}, and finally the converted names are made unique
by \code{\LinkA{make.unique}{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 \code{z}
prepended.

If \code{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 \file{Read-and-delete-me} file, as it
should not be distributed.
\end{Details}
\begin{Value}
used for its side-effects.
\end{Value}
\begin{References}\relax
Read the \emph{Writing R Extensions} manual for more details.

Once you have created a \emph{source} package you need to install it:
see the \emph{R Installation and Administration} manual,
\code{\LinkA{INSTALL}{INSTALL}} and \code{\LinkA{install.packages}{install.packages}}.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{prompt}{prompt}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## 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")

\end{ExampleCode}
\end{Examples}

