package.skeleton            package:utils            R Documentation

_C_r_e_a_t_e _a _S_k_e_l_e_t_o_n _f_o_r _a _N_e_w _S_o_u_r_c_e _P_a_c_k_a_g_e

_D_e_s_c_r_i_p_t_i_o_n:

     'package.skeleton' automates some of the setup for a new source
     package.  It creates directories, saves functions, data, and R
     code files to appropriate places, and creates skeleton help files
     and a 'Read-and-delete-me' file describing further steps in
     packaging.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

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

    list: character vector naming the R objects to put in the package. 
          Usually, at most one of 'list', 'environment', or
          'code_files' will be supplied.  See 'Details'.

environment: an environment where objects are looked for.  See
          'Details'.

    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.  If 'TRUE', a 'NAMESPACE' file is created to export
          all objects whose names begin with a letter, plus all S4
          methods and classes.

code_files: a character vector with the paths to R code files to build
          the package around.  See 'Details'.

_D_e_t_a_i_l_s:

     The arguments 'list', 'environment', and 'code_files' provide
     alternative ways to initialize the package.  If 'code_files' is
     supplied, the files so named will be sourced to form the
     environment, then used to generate the package skeleton. Otherwise
     'list' defaults to the non-hidden files in 'environment' (those
     whose name does not start with '.'), but can be supplied to select
     a subset of the objects in that environment.

     Stubs of help files are generated for functions, data objects, and
     S4 classes and methods, using the 'prompt', 'promptClass',  and
     'promptMethods' functions.

     The package sources are placed in subdirectory 'name' of 'path'. 
     If 'code_files' is supplied, these files are copied; otherwise,
     objects will be dumped into individual source files. The file
     names in 'code_files' should  have suffix '".R"' and be in the
     current working directory.

     The  filenames created for source and documentation try to be
     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' file, as it
     should not be distributed.

_V_a_l_u_e:

     Used for its side-effects.

_R_e_f_e_r_e_n_c_e_s:

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

_S_e_e _A_l_s_o:

     'prompt', 'promptClass', and 'promptMethods'.

_E_x_a_m_p_l_e_s:

     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")

