\name{QC}
\alias{QC}
\alias{checkDocFiles}
\alias{checkDocStyle}
\alias{checkReplaceFuns}
\alias{checkS3methods}
\alias{print.checkDocFiles}
\alias{print.checkDocStyle}
\alias{print.checkReplaceFuns}
\alias{print.checkS3methods}
\title{QC Checks for R Code and/or Documentation}
\description{
  Functions for performing various quality checks.
}
\usage{
checkDocFiles(package, dir, lib.loc = NULL)
checkDocStyle(package, dir, lib.loc = NULL)
checkReplaceFuns(package, dir, lib.loc = NULL)
checkS3methods(package, dir, lib.loc = NULL)
}
\arguments{
  \item{package}{a character string naming an installed package.}
  \item{dir}{a character string specifying the path to a package's root
    source directory.  This should contain the subdirectories \code{R}
    (for R code) and \file{man} with \R documentation sources (in Rd
    format).  Only used if \code{package} is not given.}
  \item{lib.loc}{a character vector of directory names of \R libraries,
    or \code{NULL}.  The default value of \code{NULL} corresponds to all
    libraries currently known.  The specified library trees are used to
    to search for \code{package}.}
}
\details{
  \code{checkDocFiles} checks, for all Rd files in a package, whether all
  arguments shown in the usage sections of the Rd file are documented in
  its arguments section.  It also reports duplicated entries in the
  arguments section, and \dQuote{over-documented} arguments which are
  given in the arguments section but not in the usage.  Note that the
  match is for the usage section and not a possibly existing synopsis
  section, as the usage is what gets displayed.

  \code{checkDocStyle} investigates how (S3) methods are shown in the
  usages of the Rd files in a package.  It reports the methods shown by
  their full name rather than using the Rd \code{\\method} markup for
  indicating S3 methods.  Earlier versions of \R also reported about
  methods shown along with their generic, which typically caused
  problems for the documentation of the primary argument in the generic
  and its methods.  With \code{\\method} now being expanded in a way
  that class information is preserved, \dQuote{joint} documentation is
  no longer necessarily a problem.  (The corresponding information is
  still contained in the object returned by \code{checkDocStyle}.)

  \code{checkReplaceFuns} checks whether replacement functions or S3/S4
  replacement methods in the package R code have their final argument
  named \code{value}.

  \code{checkS3methods} checks whether all S3 methods defined in the
  package R code have all arguments of the corresponding generic, with
  positional arguments of the generics in the same positions for the
  method.  As an exception, the first argument of a formula method
  \emph{may} be called \code{formula} even if this is not the name used
  by the generic.  The rules when \code{\dots} is involved are subtle:
  see the source code.  Functions recognized as S3 generics are those
  with a call to \code{UseMethod} in their body, internal S3 generics
  (see \code{\link[base]{zMethods}}), and S3 group generics (see
  \code{\link[base]{Math}}).  Possible dispatch under a different name
  is not taken into account.  The generics are sought first in the given
  package and then in the \pkg{base} package (but currently not in other
  packages \dQuote{used} by the given package).  

  If using an installed package, the checks needing access to all R
  objects of the package will load the package (unless it is the
  \pkg{base} package), after possibly detaching an already loaded
  version of the package.
}
\value{
  The functions return objects of class the same as the respective
  function names containing the information about problems detected.
  There is a \code{print} method for nicely displaying the information
  contained in such objects.
}
\section{Warning}{
  These functions are still experimental.  Names, interfaces and values
  might change in future versions.
}
\keyword{utilities}
\keyword{documentation}
\eof
\name{Rdindex}
\title{Generate Index from Rd Files}
\alias{Rdindex}
\description{
  Print a 2-column index table with names and titles from given R
  documentation files to a given output file or connection.  The titles
  are nicely formatted between two column positions (typically 25 and
  72, respectively).
}
\usage{
Rdindex(RdFiles, outFile = "", type = NULL,
        width = 0.9 * getOption("width"), indent = NULL)
}
\arguments{
  \item{RdFiles}{a character vector specifying the Rd files to be used
    for creating the index, either by giving the paths to the files, or
    the path to a single directory with the sources of a package.}
  \item{outFile}{a connection, or a character string naming the output
    file to print to.  \code{""} (the default) indicates output is to
    the console.}
  \item{type}{a character string giving the documentation type of the Rd
    files to be included in the index, or \code{NULL} (the default).
    The type of an Rd file is typically specified via the
    \code{\\docType} tag; if \code{type} is \code{"data"}, Rd files
    whose \emph{only} keyword is \code{datasets} are included as well.}
  \item{width}{a positive integer giving the target column for wrapping
    lines in the output.}
  \item{indent}{a positive integer specifying the indentation of the
    second column.  Must not be greater than \code{width/2}, and
    defaults to \code{width/3}.}
}
%% Currently no \example: at run time we do not have direct access to Rd
%% files.  What we could do is take an installed Rd archive, and extract
%% by splitting on the new-style \eof file separator, but we really want
%% a simple example, right?
\keyword{documentation}
\keyword{utilities}

\eof
\name{Rtangle}
\alias{Rtangle}
\alias{RtangleSetup}
\title{R Driver for Stangle}
\description{
  A driver for \code{\link{Stangle}} that extracts R code chunks.
}
\usage{
Rtangle()
RtangleSetup(file, syntax, output=NULL, annotate=TRUE, split=FALSE,
             prefix=TRUE, quiet=FALSE)
}
\arguments{
  \item{file}{Name of Sweave source file.}
  \item{syntax}{An object of class \code{SweaveSyntax}.}
  \item{output}{Name of output file, default is to remove extension \file{.nw},
    \file{.Rnw} or \file{.Snw} and to add extension \file{.R}. Any
    directory names in \code{file} are also removed such that the output
    is created in the current working directory.}
  \item{annotate}{By default, code chunks are seperated by comment
    lines specifying the names and numbers of the code chunks. If
    \code{FALSE}, only the code chunks without any decorating comments
    are extracted.}
  \item{split}{Split output in single files per code chunk?}
  \item{prefix}{If \code{split=TRUE}, prefix the chunk labels by the
    basename of the input file to get output file names?}
  \item{quiet}{If \code{TRUE} all progress messages are suppressed.}
}
\author{Friedrich Leisch}
\references{
  Friedrich Leisch: Sweave User Manual, 2002\cr
  \url{http://www.ci.tuwien.ac.at/~leisch/Sweave}
}
\seealso{\code{\link{Sweave}}, \code{\link{RweaveLatex}}}
\keyword{utilities}

\eof
\name{RweaveLatex}
\alias{RweaveLatex}
\alias{RweaveLatexSetup}
\title{R/LaTeX Driver for Sweave}
\description{
  A driver for \code{\link{Sweave}} that translates R code chunks in
  LaTeX files.
}
\usage{
RweaveLatex()
RweaveLatexSetup(file, syntax, output=NULL, quiet=FALSE, debug=FALSE,
                 echo=TRUE, eval = TRUE, split=FALSE, stylepath=TRUE,
                 pdf=TRUE, eps=TRUE)
}
\arguments{
  \item{file}{Name of Sweave source file.}
  \item{syntax}{An object of class \code{SweaveSyntax}.}
  \item{output}{Name of output file, default is to remove extension
    \file{.nw}, \file{.Rnw} or \file{.Snw} and to add extension
    \file{.tex}. Any 
    directory names in \code{file} are also removed such that the output
    is created in the current working directory.}
  \item{quiet}{If \code{TRUE} all progress messages are suppressed.}
  \item{debug}{If \code{TRUE}, input and output of all code
    chunks is copied to the console.}
  \item{stylepath}{If \code{TRUE}, a hard path to the file \file{Sweave.sty}
    installed with this package is set, if \code{FALSE}, only
    \code{\\usepackage\{Sweave\}} is written. The hard path makes the
    TeX file less
    portable, but avoids the problem of installing the current
    version of \file{Sweave.sty} to some place in your TeX input path.
    The argument is ignored if a \code{\\usepackage\{Sweave\}} is
    already present in the Sweave source file.
  }
  \item{echo}{set default for option \code{echo}, see details below.}
  \item{eval}{set default for option \code{eval}, see details below.}
  \item{split}{set default for option \code{split}, see details below.}
  \item{pdf}{set default for option \code{pdf}, see details below.}
  \item{eps}{set default for option \code{eps}, see details below.}
}
\section{Supported Options}{
  RweaveLatex supports the following options for code chunks (the values
  in parentheses show the default values):
  \describe{
    \item{echo:}{logical (\code{TRUE}). Include S code in the
      output file?}
    \item{eval:}{logical (\code{TRUE}). If \code{FALSE}, the code chunk is not
      evaluated, and hence no text or graphical output produced.}
    \item{results:}{character string (\code{verbatim}).
      If \code{verbatim}, the output of S commands is
      included in the verbatim-like Soutput environment. If
      \code{tex}, the output is taken to be already proper latex markup
      and included as is. If \code{hide} then all output is
      completely suppressed (but the code executed during the weave).}
    \item{print:}{logical (\code{FALSE})
      If \code{TRUE}, each expression in the
      code chunk is wrapped into a \code{print()} statement before evaluation,
      such that the values of all expressions become visible.}
    \item{term:}{logical (\code{TRUE}). If \code{TRUE}, visibility of values
      emulates an interactive R session: values of assignments are not
      printed, values of single objects are printed. If \code{FALSE},
      output comes only from explicit \code{\link{print}} or
      \code{\link{cat}} statements.}
    \item{split:}{logical (\code{FALSE}). If \code{TRUE}, text output is
      written to separate files 
      for each code chunk.}
    \item{strip.white:}{logical (\code{TRUE}). If \code{TRUE}, blank
      lines at the beginning and end of output are removed.}
    \item{prefix:}{logical (\code{TRUE}). If \code{TRUE} generated filenames of
      figures and output have a common prefix.}
    \item{prefix.string:}{a character string, default is the name of the
      \file{.Snw} source file.}
    \item{include:}{logical (\code{TRUE}), indicating whether input
      statements for text output and includegraphics statements
      for figures should be auto-generated. Use \code{include=FALSE} if
      the output should appear in a different place than the code chunk
      (by placing the input line manually).}
    \item{fig:}{logical (\code{FALSE}), indicating whether the code
      chunk produces 
      graphical output. Note that only one figure per code chunk can be
      processed this way.}
    \item{eps:}{logical (\code{TRUE}), indicating whether EPS figures shall be
      generated. Ignored if \code{fig=FALSE}.} 
    \item{pdf:}{logical (\code{TRUE}), indicating whether PDF figures shall be
      generated. Ignored if \code{fig=FALSE}.}
    \item{width:}{numeric (6), width of figures in inch.}
    \item{height:}{numeric (6), height of figures in inch.}
  }
}
\author{Friedrich Leisch}
\references{
  Friedrich Leisch: Sweave User Manual, 2002\cr
  \url{http://www.ci.tuwien.ac.at/~leisch/Sweave}
}
\seealso{\code{\link{Sweave}}, \code{\link{Rtangle}}}
\keyword{utilities}
\eof
\name{Sweave}
\alias{Sweave}
\alias{Stangle}
\alias{SweaveSyntaxLatex}
\alias{SweaveSyntaxNoweb}
\title{Automatic Generation of Reports}
\description{
  \code{Sweave} provides a flexible framework for mixing text and S code
  for automatic report generation. The basic idea is to replace the S
  code with its output, such that the final document only contains the
  text and the output of the statistical anlysis. 
}
\usage{
Sweave(file, driver=RweaveLatex(), syntax=getOption("SweaveSyntax"), ...)
Stangle(file, driver=Rtangle(), syntax=getOption("SweaveSyntax"), ...)
}
\arguments{
  \item{file}{Name of Sweave source file.}
  \item{driver}{The actual workhorse, see details below.}
  \item{syntax}{An object of class \code{SweaveSyntax} or a character
    string with its name. The default installation provides
    \code{SweaveSyntaxNoweb} and \code{SweaveSyntaxLatex}.}
  \item{\dots}{Further arguments passed to the driver's setup function.}
}
\details{
  Automatic generation of reports by mixing word processing markup (like
  latex) and S code. The S code gets replaced by its output (text or
  graphs) in the final markup file. This allows to re-generate a report
  if the input data change and documents the code to reproduce the
  analysis in the same file that also produces the report.

  \code{Sweave} combines the documentation and code chunks together
  (or their output) into a single document. \code{Stangle} extracts only
  the code from the Sweave file creating a valid S source file (that can
  be run using \code{\link{source}}). Code inside \code{\\Sexpr\{\}}
  statements is ignored by \code{Stangle}.

  \code{Stangle} is just a
  frontend to \code{Sweave} using a simple driver by default, which
  discards the documentation and concatenates all code chunks the
  current S engine understands.
}   
\section{Hook Functions}{
  Before each code chunk is evaluated, a number of hook functions can be
  executed. If \code{getOption("SweaveHooks")} is set,
  it is taken to be a collection of hook functions. For each logical
  option of a code chunk (\code{echo}, \code{print}, \ldots) a hook can
  be specified, which is executed if and only if the respective option
  is \code{TRUE}. Hooks must be named elements of the list returned by
  \code{getOption("SweaveHooks")} and be functions taking no
  arguments. E.g., if option
  \code{"SweaveHooks"} is defined as \code{list(fig = foo)}, and
  \code{foo} is a function, then
  it would be executed before the code in each
  figure chunk. This is especially useful to set defaults for the
  graphical parameters in a series of figure chunks.

  Note that the user is free to define new Sweave options and associate
  arbitrary hooks with them. E.g., one could define a hook function for
  option \code{clean} that removes all objects in the global
  environment. Then all code chunks with \code{clean=TRUE} would start
  operating on an empty workspace.
}
\section{Syntax Definition}{
  Sweave allows a very flexible syntax framework for marking
  documentation and text chunks. The default is a noweb-style syntax, as
  alternative a latex-style syntax can be used. See the user manual for
  details.
}
\author{Friedrich Leisch}
\references{
  Friedrich Leisch: Sweave User Manual, 2002\cr
  \url{http://www.ci.tuwien.ac.at/~leisch/Sweave}

  Friedrich Leisch: Dynamic generation of statistical reports using
  literate data analysis. In W. Härdle and B. Rönz,
  editors, Compstat 2002 - Proceedings in Computational
  Statistics, pages 575-580. Physika Verlag, Heidelberg, Germany,
  2002. ISBN 3-7908-1517-9.
}
\seealso{\code{\link{RweaveLatex}}, \code{\link{Rtangle}}}
\examples{
testfile <- system.file("Sweave", "Sweave-test-1.Rnw",
		        package = "tools")

## create a LaTeX file
Sweave(testfile)

## create an S source file from the code chunks
Stangle(testfile)
## which can be simply sourced
source("Sweave-test-1.R")

\dontshow{if(!interactive()) unlink("Sweave-test-1*")}
}
\keyword{utilities}
\eof
\name{SweaveSyntConv}
\alias{SweaveSyntConv}
\title{Convert Sweave Syntax}
\description{
  This function converts the syntax of files in \code{\link{Sweave}}
  format to another Sweave syntax definition. 
}
\usage{
SweaveSyntConv(file, syntax, output=NULL)
}
\arguments{
  \item{file}{Name of Sweave source file.}
  \item{syntax}{An object of class \code{SweaveSyntax} or a character
    string with its name giving the target syntax to which the file is
    converted.}
  \item{output}{Name of output file, default is to remove the extension
    from the input file and to add the default extension of the target
    syntax. Any directory names in \code{file} are also removed such
    that the output is created in the current working directory.}}
\author{Friedrich Leisch}
\references{
  Friedrich Leisch: Sweave User Manual, 2002\cr
  \url{http://www.ci.tuwien.ac.at/~leisch/Sweave}
}
\seealso{\code{\link{RweaveLatex}}, \code{\link{Rtangle}}}
\examples{
testfile <- system.file("Sweave", "Sweave-test-1.Rnw",
		        package = "tools")

## convert the file to latex syntax
SweaveSyntConv(testfile, SweaveSyntaxLatex)

## and run it through Sweave
Sweave("Sweave-test-1.Stex")

\dontshow{if(!interactive()) unlink("Sweave-test-1*")}
}
\keyword{utilities}
\eof
\name{checkFF}
\alias{checkFF}
\alias{print.checkFF}
\title{Check Foreign Function Calls}
\usage{
checkFF(package, dir, file, lib.loc = NULL,
        verbose = getOption("verbose"))
}
\description{
  Performs checks on calls to compiled code from R code.  Currently only
  whether the interface functions such as \code{.C} and \code{.Fortran}
  are called with argument \code{PACKAGE} specified, which is highly
  recommended to avoid name clashes in foreign function calls.
}
\arguments{
  \item{package}{a character string naming an installed package.  If
    given, the installed R code of the package is checked.}
  \item{dir}{a character string specifying the path to a package's root
    source directory.  This should contain the subdirectory \code{R}
    (for R code).  Only used if \code{package} is not given.}
  \item{file}{the name of a file containing R code to be checked.  Used
    if neither \code{package} nor \code{dir} are given.}
  \item{lib.loc}{a character vector of directory names of \R libraries,
    or \code{NULL}.  The default value of \code{NULL} corresponds to all
    libraries currently known.  The specified library trees are used to
    to search for \code{package}.}
  \item{verbose}{a logical.  If \code{TRUE}, additional diagnostics are
    printed (and the result is returned invisibly).}
}
\value{
  An object of class \code{"checkFF"}, which currently is a list of the
  (parsed) foreign function calls with no \code{PACKAGE} argument.

  There is a \code{print} method for nicely displaying the information
  contained in such objects.
}
\seealso{
  \code{\link{.C}},
  \code{\link{.Fortran}};
  \code{\link{Foreign}}.
}
\section{Warning}{
  This function is still experimental.  Both name and interface might
  change in future versions.
}
\examples{
checkFF(package = "ts", verbose = TRUE)
}
\keyword{programming}
\keyword{utilities}
\eof
\name{checkMD5sums}
\alias{checkMD5sums}
\alias{.installMD5sums}
\title{Check and Create MD5 Checksum Files}
\description{
  \code{checkMD5sums} checks the files against a file \code{MD5};
  \code{.installMD5sums} creates such a file.
}
\usage{
checkMD5sums(pkg, dir)
.installMD5sums(pkgDir, outDir = pkgDir)
}
\arguments{
  \item{pkg}{the name of an installed package}
  \item{dir, pkgDir}{the path to the top-level directory of an installed
    package.}
  \item{outDir}{the directory within which to create the \code{MD5} file.}
}
\details{
  The file \file{MD5} which is created is in a format which can be
  checked by \code{md5sum -c MD5} if a suitable command-line version of
  \code{md5sum} is available.

  If \code{dir} is missing, an installed package of name \code{pkg} is
  searched for.
}
\value{
  \code{checkMD5sums} returns a logical, \code{NA} if there is no
  \code{MD5} file to be checked.
}
\seealso{\code{\link{md5sum}}}

\keyword{utilities}
\eof
\name{checkTnF}
\alias{checkTnF}
\alias{print.checkTnF}
\title{Check R Packages or Code for T/F}
\description{
  Checks the specified R package or code file for occurrences of
  \code{T} or \code{F}, and gathers the expression containing these.
  This is useful as in R \code{T} and \code{F} are just variables which
  are set to the logicals \code{TRUE} and \code{FALSE} by default, but
  are not reserved words and hence can be overwritten by the user.
  Hence, one should always use \code{TRUE} and \code{FALSE} for the
  logicals.
}
\usage{
checkTnF(package, dir, file, lib.loc = NULL)
}
\arguments{
  \item{package}{a character string naming an installed package.  If
    given, the installed R code and the examples in the documentation
    files of the package are checked.  R code installed as an image file
    cannot be checked.}
  \item{dir}{a character string specifying the path to a package's root
    source directory.  This must contain the subdirectory \file{R} (for
    R code), and should also contain \file{man} (for documentation).
    Only used if \code{package} is not given.  If used, the R code files
    and the examples in the documentation files are checked.}
  \item{file}{the name of a file containing R code to be checked.  Used
    if neither \code{package} nor \code{dir} are given.}
  \item{lib.loc}{a character vector of directory names of \R libraries,
    or \code{NULL}.  The default value of \code{NULL} corresponds to all
    libraries currently known.  The specified library trees are used to
    to search for \code{package}.}
}
\value{
  An object of class \code{"checkTnF"} which is a list containing, for
  each file where occurences of \code{T} or \code{F} were found, a list
  with the expressions containing these occurrences.  The names of the
  list are the corresponding file names.

  There is a \code{print} method for nicely displaying the information
  contained in such objects.
}
\section{Warning}{
  This function is still experimental.  Both name and interface might
  change in future versions.
}
\keyword{utilities}
\keyword{documentation}
\eof
\name{checkVignettes}
\alias{checkVignettes}
\alias{print.checkVignettes}
\title{Check Package Vignettes}
\description{
  Check all \code{\link{Sweave}} files of a package by running
  \code{\link{Sweave}} and/or \code{\link{Stangle}} on them. All
  R source code files found after the tangling step are
  \code{\link{source}}ed to check whether all code can be
  executed without errors.
}
\usage{
checkVignettes(package, dir, lib.loc = NULL, tangle = TRUE,
               weave = TRUE, workdir = c("tmp", "src", "cur"),
               keepfiles = FALSE)
}
\arguments{
 \item{package}{a character string naming an installed package.  If
    given, Sweave files are searched in subdirectory \code{doc}.}
  \item{dir}{a character string specifying the path to a package's root
    source directory.  This subdirectory \code{inst/doc} is searched for
    Sweave files.}
  \item{lib.loc}{a character vector of directory names of \R libraries,
    or \code{NULL}.  The default value of \code{NULL} corresponds to all
    libraries currently known.  The specified library trees are used to
    to search for \code{package}.}
  \item{tangle}{Perform a tangle and \code{\link{source}} the extraced code?}
  \item{weave}{Perform a weave?}
  \item{workdir}{Directory used as working directory while checking the
    vignettes. If \code{"tmp"} then a temporary directory is created,
    this is the default.  If \code{"src"} then the directory containing
    the vignettes itself is used, if \code{"cur"} then the current
    working directory of \R is used.}
  \item{keepfiles}{Delete file in temporary directory? This option is
    ignored when \code{workdir!="tmp"}.}
}
\value{
  An object of class \code{"checkVignettes"} which is a list with the
  error messages found during the tangle and weave steps. There is a
  \code{print} method for nicely displaying the information 
  contained in such objects.
}
\keyword{utilities}
\keyword{documentation}
\eof
\name{codoc}
\alias{codoc}
\alias{codocClasses}
\alias{codocData}
\alias{print.codoc}
\alias{print.codocClasses}
\alias{print.codocData}
\title{Check Code/Documentation Consistency}
\usage{
codoc(package, dir, lib.loc = NULL,
      use.values = FALSE, use.positions = TRUE,
      ignore.generic.functions = FALSE,
      verbose = getOption("verbose"))
codocClasses(package, lib.loc = NULL)
codocData(package, lib.loc = NULL)
}
\description{
  Find inconsistencies between actual and documented \dQuote{structure}
  of \R objects in a package.  \code{codoc} compares names and
  optionally also corresponding positions and default values of the
  arguments of functions.  \code{codocClasses} and \code{codocData}
  compare slot names of S4 classes and variable names of data sets,
  respectively.
}
\arguments{
  \item{package}{a character string naming an installed package.}
  \item{dir}{a character string specifying the path to a package's root
    source directory.  This must contain the subdirectories \file{man}
    with \R documentation sources (in Rd format) and \file{R} with \R
    code.  Only used if \code{package} is not given.}
  \item{lib.loc}{a character vector of directory names of \R libraries,
    or \code{NULL}.  The default value of \code{NULL} corresponds to all
    libraries currently known.  The specified library trees are used to
    to search for \code{package}.}
  \item{use.positions}{a logical indicating whether to use the positions
    of function arguments when comparing.  \emph{Deprecated}.}
  \item{use.values}{if \code{FALSE} (current default), do not use
    function default values when comparing code and docs.  Otherwise,
    compare \emph{all} default values if \code{TRUE}, and only the ones
    documented in the usage otherwise.}
  \item{ignore.generic.functions}{if \code{TRUE}, functions recognized
    as S3 generics are ignored.  \emph{Deprecated}.}
  \item{verbose}{a logical.  If \code{TRUE}, additional diagnostics are
    printed.}
}
\note{
  The default for \code{use.values} is going to be changed from
  \code{FALSE} to \code{NULL}, right after release of \R version 1.8.0.
}
\details{
  The purpose of \code{codoc} is to check whether the documented usage
  of function objects agrees with their formal arguments as defined in
  the \R code.  This is not always straightforward, in particular as the
  usage information for methods to generic functions often employs the
  name of the generic rather than the method.

  The following algorithm is used.  If an installed package is used, it
  is loaded (unless it is the base package), after possibly detaching an
  already loaded version of the package.  Otherwise, if the sources are
  used, the \R code files of the package are collected and sourced in a
  new environment.  Then, the usage sections of the Rd files are
  extracted and parsed \dQuote{as much as possible} to give the formals
  documented.  For interpreted functions in the code environment, the
  formals are compared between code and documentation according to the
  values of the arguments \code{use.positions} and \code{use.values}.
  Synopsis sections are used if present; their occurrence is reported if
  \code{verbose} is true.

  Currently, the R documentation format has no high-level markup for the
  basic \dQuote{structure} of classes and data sets (similar to the
  usage sections for function synopses).  Variable names for data frames
  in documentation objects obtained by suitably editing \dQuote{shells}
  created by \code{\link{prompt}} are recognized by \code{codocData} and
  used provided that the documentation object is for a single data frame
  (i.e., only has one alias).  \code{codocClasses} analogously handles
  slot names for classes in documentation objects obtained by editing
  shells created by \code{\link[methods]{promptClass}}.
}
\value{
  \code{codoc} returns an object of class \code{"codoc"}.  Currently,
  this is a list which, for each Rd object in the package where an
  inconsistency was found, contains an element with a list of the
  mismatches (which in turn are lists with elements \code{code} and
  \code{docs}, giving the corresponding arguments obtained from the
  function's code and documented usage).

  \code{codocClasses} and \code{codocData} return objects of class
  \code{"codocClasses"} and \code{"codocData"}, respectively, with a
  structure similar to class \code{"codoc"}.

  There are \code{print} methods for nicely displaying the information
  contained in such objects.
}
\seealso{
  \code{\link{undoc}}
}
\section{Warning}{
  Both \code{codocClasses} and \code{codocData} are still experimental.
  Names, interfaces and values might change in future versions.
}
\keyword{documentation}
\eof
\name{delimMatch}
\alias{delimMatch}
\title{Delimited Pattern Matching}
\description{
  Match delimited substrings in a character vector, with proper nesting.
}
\usage{
delimMatch(x, delim = c("\{", "\}"), syntax = "Rd")
}
\arguments{
  \item{x}{a character vector.}
  \item{delim}{a character vector of length 2 giving the start and end
    delimiters.  Currently, both must be single characters.  Future
    versions might allow for arbitrary regular expressions.}
  \item{syntax}{currently, always the string \samp{"Rd"} indicating Rd
    syntax (i.e., \samp{\%} starts a comment extending till the end of
    the line, and \samp{\\} escapes).  Future versions might know about
    other syntaxes, perhaps via \dQuote{syntax tables} allowing to
    flexibly specify comment, escape, and quote characters.}
}
\value{
  An integer vector of the same length as \code{x} giving the starting
  position of the first match, or \eqn{-1} if there is none, with
  attribute \code{"match.length"} giving the length of the matched text
  (or \eqn{-1} for no match).
}
\seealso{
  \code{\link{regexpr}} for \dQuote{simple} pattern matching.
}
\examples{
x <- c("\value\{foo\}", "function(bar)")
delimMatch(x)
delimMatch(x, c("(", ")"))
}
\keyword{character}
\eof
\name{fileutils}
\alias{filePathAsAbsolute}
\alias{filePathSansExt}
\alias{fileTest}
\alias{listFilesWithExts}
\alias{listFilesWithType}
\title{File Utilities}
\description{
  Utilities for testing and listing files, and manipulating file paths.
}
\usage{
filePathAsAbsolute(x)
filePathSansExt(x)
fileTest(op, x, y)
listFilesWithExts(dir, exts, all.files = FALSE, full.names = TRUE)
listFilesWithType(dir, type, all.files = FALSE. full.names = TRUE)
}
\arguments{
  \item{x,y}{character vectors giving file paths.}
  \item{op}{a character string specifying the test to be performed.
    Unary tests (only \code{x} is used) are \code{"-f"} (existence and
    not being a directory) and \code{"-d"} (existence and directory);
    binary tests are \code{"-nt"} (newer than, using the modification
    dates) and \code{"-ot"}.}
  \item{dir}{a character string with the path name to a directory.}
  \item{exts}{a character vector of possible file extensions.}
  \item{all.files}{a logical.  If \code{FALSE} (default), only visible
    files are considered; if \code{TRUE}, all files are used.}
  \item{full.names}{a logical indicating whether the full paths of the
    files found are returned (default), or just the file names.}
  \item{type}{a character string giving the \dQuote{type} of the files
    to be listed, as characterized by their extensions.  Currently,
    possible values are \code{"code"} (R code), \code{"data"} (data
    sets), \code{"demo"} (demos), \code{"docs"} (R documentation), and
    \code{"vignette"} (vignettes).}
}
\details{
  \code{filePathAsAbsolute} turns a possibly relative file path
  absolute, performing tilde expansion if necessary.  Currently, only a
  single existing path can be given.

  \code{filePathSansExt} returns the file paths without extensions.
  (Only purely alphanumeric extensions are recognized.)

  \code{fileTest} performs shell-style file tests.  Note that
  \code{\link{file.exists}} only tests for existence (\code{test -e} on
  some systems) but not for not being a directory.

  \code{listFilesWithExts} returns the paths or names of the files in
  directory \code{dir} with extension matching one of the elements of
  \code{exts}.  Note that by default, full paths are returned, and that
  only visible files are used.

  \code{listFilesWithType} returns the paths of the files in \code{dir}
  of the given \dQuote{type}, as determined by the extensions recognized
  by \R.  When listing R code and documentation files, files in
  OS-specific subdirectories are included if present.  Note that by
  default, full paths are returned, and that only visible files are
  used.
}
\seealso{
  \code{\link{file.path}},
  \code{\link{file.info}},
  \code{\link{list.files}}
}
\examples{
dir <- file.path(R.home(), "library", "eda")
fileTest("-d", dir)
fileTest("-nt", file.path(dir, "R"), file.path(dir, "demo"))
listFilesWithExts(file.path(dir, "demo"), "R")
listFilesWithType(file.path(dir, "demo"), "demo") # the same
filePathSansExt(list.files(file.path(R.home(), "modules")))
}
\keyword{file}
\eof
\name{md5sum}
\alias{md5sum}
\title{Compute MD5 Checksums}
\description{
  Compute the 32-byte MD5 checksums of one or more files.
}
\usage{
md5sum(files)
}
\arguments{
  \item{files}{character. The paths of file(s) to be check-summed.}
}
\value{
  A character vector of the same length as \code{files}, with names
  equal to \code{files}. The elements
  will be \code{NA} for non-existent or unreadable files, otherwise
  a 32-character string of hexadecimal digits.

  On Windows all files are read in binary mode (as the \code{md5sum}
  utilities there do): on other OSes the files are read in the default way.
}
\seealso{
  \code{\link{checkMD5sums}}
}
\examples{
md5sum(dir(R.home(), pattern="^COPY", full.names=TRUE))
}
\keyword{utilities}

\eof
\name{tools-internal}
\title{Internal tools Objects}
% \alias{.isS3Generic}
% \alias{.loadPackageQuietly}
% \alias{.makeFileExts}
% \alias{.makeS3MethodsStopList}
% \alias{.sourceAssignments}
% \alias{SweaveParseOptions}
% \alias{SweaveHooks}
% \alias{RweaveLatexRuncode}
% \alias{RweaveLatexWritedoc}
% \alias{RweaveLatexFinish}
\alias{RweaveLatexOptions}
% \alias{RweaveChunkPrefix}
% \alias{RweaveEvalWithOpt}
% \alias{RtangleRuncode}
\alias{RtangleWritedoc}
% \alias{RtangleFinish}
% \alias{SweaveGetSyntax}
\alias{buildVignettes}
\alias{pkgVignettes}
% \alias{Rdpp}
% \alias{Rdinfo}
% \alias{Rdcontents}
% \alias{Rd2contents}
\alias{.installPacakgeCodeFiles}
\alias{.installPackageDescription}
\alias{.installPackageIndices}
% \alias{.installPackageRdIndices}
% \alias{.installPackageVignetteIndex}
% \alias{.installPackageDemoIndex}
% \alias{.writeContentsRDS}
% \alias{.writeContentsDCF}
% \alias{.buildRdIndex}
% \alias{.buildVignetteIndex}
% \alias{.buildDemoIndex}
% \alias{.buildDataIndex}
\alias{.checkVignetteIndex}
\alias{print.checkVignetteIndex}
\alias{.checkDemoIndex}
\alias{print.checkDemoIndex}
% \alias{.stripRdComments}
\description{
  Internal tools functions.
}
\usage{
RweaveLatexOptions(options)
RtangleWritedoc(object, chunk)
buildVignettes(package, dir, lib.loc = NULL)
pkgVignettes(package, dir, lib.loc = NULL)

% .isS3Generic(fname, envir)
% .loadPackageQuietly(package, lib.loc)
% .makeFileExts(type)
% .makeS3MethodsStopList(package)
% .sourceAssignments(file, envir)
% Rdpp(lines)
% Rdinfo(file)
% Rdcontents(RdFiles)
% Rd2contents(dir, outFile = "")
% .stripRdComments(lines)
% .writeContentsRDS(contents, outFile)
% .writeContentsDCF(contents, packageName, outFile)
% .buildDataIndex(dataDir, contents)
% .buildDemoIndex(demoDir)
% .buildRdIndex(contents, type = NULL)
% .buildVignetteIndex(vignetteDir)
.installPackageCodeFiles(dir, outDir)
.installPackageDescription(dir, outDir)
.installPackageIndices(dir, outDir)
% .installPackageRdIndices(dir, outDir)
% .installPackageVignetteIndex(dir, outDir)
% .installPackageDemoIndex(dir, outDir)
.checkDemoIndex(demoDir)
.checkVignetteIndex(vignetteDir)
}
\details{
  These are not to be called by the user.
}
\keyword{internal}
\eof
\name{undoc}
\alias{undoc}
\alias{print.undoc}
\title{Find Undocumented Objects}
\usage{
undoc(package, dir, lib.loc = NULL)
}
\description{
  Finds the objects in a package which are undocumented, in the sense
  that they are visible to the user (or data objects or S4 classes
  provided by the package), but no documentation entry exists.
}
\arguments{
  \item{package}{a character string naming an installed package.}
  \item{dir}{a character string specifying the path to a package's root
    source directory.  This must contain the subdirectory \file{man}
    with \R documentation sources (in Rd format), and at least one of
    the \file{R} or \file{data} subdirectories with \R code or data
    objects, respectively.}
  \item{lib.loc}{a character vector of directory names of \R libraries,
    or \code{NULL}.  The default value of \code{NULL} corresponds to all
    libraries currently known.  The specified library trees are used to
    to search for \code{package}.}
}
\details{
  This function is useful for package maintainers mostly.  In principle,
  \emph{all} user level \R objects should be documented; note however
  that the precise rules for documenting methods of generic functions
  are still under discussion.
}
\value{
  An object of class \code{"undoc"} which is a list of character vectors
  containing the names of the undocumented objects split according to
  documentation type.  This representation is still experimental, and
  might change in future versions.

  There is a \code{print} method for nicely displaying the information
  contained in such objects.
}
\examples{
undoc("tools")                  # Undocumented objects in 'tools'
}
\keyword{documentation}
\eof
