CellNOpt Documentation Center (CNODocs) (0.1.6)

4.2. How to document R functions

4.2.1. Creating a manual file

All R functions in the R packages must have a manual that is a file in the man/ directory. The file has the same name as the function that is being documented except for the extension that is .Rd instead of .R

The structure should be as follows:

    A short description (one line)
    A longer description
    functionName(arg1, arg2)
        Description of arg1
        Description of arg2
    Some detailled description
    description of what is returned.
    Your name
    Pointers to related R objects, using \code{\link{...}} to refer to them (\code
    is the correct markup for R object names, and \link produces hyperlinks in
    output formats which support this.

   \dontrun{Some computationally expensive code can be shown but not run.}
   \dontshow{log(x)}    # Only run.

Some fields are optional (e.g., seealso, examples)

The layout is not of importance but to ease the writing/reading of code for developers, please use this layout for the argument section:

        a CSV MIDAS file (see details)
        logical (default to TRUE).

See the R guidelines

To test if the Rd file is correct, type this command:

R CMD Rd2pdf --vanilla functionName.Rd

If the file is compiled correctly, you should see the PDF is your favorite PDF reader.

4.2.2. Some standard arguments

Many arguments in CellNOptR and related packages appear often. For instance, CNOlist, Model and so on. Instead of rewriting again and again the text for these arguments, you can use the following convention:

CNOlist:a CNOlist structure, as created by \code{makeCNOlist}
Model:a model structure, as created by \code{readSIF}, normally pre-processed but that is not a requirement of this function
indexList:a list of indexes of the species stimulated/inhibited/measured, as created by \code{indexFinder} from a model.
indices:same as indexList
simList:a SimList structure as created by \code{prep4sim}, that has also already been cut to contain only the reactions to be evaluated