Creating a basic R package is quite simple. However, to keep it handy, you should the roxygen2 package for handling the documentation (which is why the headers in the files below start with “#'”). Here's a short overview on how to start:
File > New Project > New Directory > R Package
and fill in the detailsBuild
tab and then on More > Configure Built
. Mark “Generate documentation with Roxygen” and press the Configure
button afterwards to additionally mark the line called “NAMESACE file”.Build
tab again and click on More > Document
to generate the documentation files. Click on Clean and Rebuild
in the same drop down menu afterwards.For more information have a look at these how-tos on creating R Packages, writing documentation and R packages in general.
#' One line information #' #' A view lines describing the package in more #' detail. #' #' @name Name of the package #' @aliases Short name of the package #' @docType package #' @title Title of the package #' @author name of the author(s)\cr #' \cr #' \emph{Maintainer:} Maintainer of the package \email{maintainer@@some-email.de} #' #' @keywords package #' NULL
#' One line description #' #' @description #' More detailed, multi-line #' description. #' #' @param example1 some parameter of the function #' @param example2 some other parameter of the function #' #' @return what the function does return #' #' @export nameOfTheFunction #' #' @examples #' not run: #' nameOfTheFunction(example1= "X", example2 = 5) nameOfTheFunction <- function(...){...}