[R-pkgs] Roxygen2: version 2.2

From: Hadley Wickham <hadley_at_rice.edu>
Date: Sun, 13 Nov 2011 09:36:33 -0600


# Roxygen2

The premise of `roxygen2` is simple: describe your functions in comments next to where their definitions and `roxygen2` will process your source code and comments to produce R compatible Rd files. Here's a simple example from the `stringr` package:
    #' The length of a string (in characters).    #'    #' @param
string input character vector    #' @return numeric vector giving number of characters in each element of the     #'   character vector.
 Missing string have missing length.    #' @keywords character    #'
@seealso \code{\link{nchar}} which this function wraps    #' @export  #' @examples    #' str_length(letters)    #' str_length(c("i", "like", "programming", NA))    str_length <- function(string) { string <- check_string(string)
      nc <- nchar(string, allowNA = TRUE)      is.na(nc) <-
is.na(string)      nc    }
When you `roxygenise` your package these comments will be automatically transformed to the Rd file you need to pass `R CMD check`:
    \name{str_length}    \alias{str_length}    \title{The length of a
string (in characters).}    \usage{str_length(string)}    \arguments{
    \item{string}{input character vector}    }    \description{
The length of a string (in characters).    } \seealso{\code{\link{nchar}} which this function wraps} \value{numeric vector giving number of characters in each element of the    character vector.  Missing string have missing length.} \keyword{character}    \examples{      str_length(letters) str_length(c("i", "like", "programming", NA))    } roxygen2 2.2


NEW FEATURES

BUG FIXES

       @useDynLib packageName routine1 routine2

   produces

       useDynLib(packageName, routine1)
       useDynLib(packageName, routine2)

   in the NAMESPACE file, instead of separate (wrong) useDynLib statements as    before.

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

_______________________________________________
R-packages mailing list
R-packages_at_r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages
Received on Mon 14 Nov 2011 - 02:39:31 EST

This archive was generated by hypermail 2.2.0 : Mon 14 Nov 2011 - 02:40:01 EST