As a simple, concrete example:
#' Inverse Value Matching
#'
#' Complement of \code{%in%}. Returns the elements of \code{x} that are
#' not in \code{y}.
#' @usage x %nin% y
#' @param x a vector
#' @param y a vector
#' @export
"%nin%" <- function(x, y) {
return( !(x %in% y) )
}
However, when I attempt to build a package the function seems to be ignored and no documentation is generated.
There seems to be a one-line blurb about binary infix functions at http://cran.r-project.org/doc/manuals/r-release/R-exts.html#Documenting-functions, but I am having a hard time parsing it, and what it would imply for Roxygen documentation.
You need to escape the
%s in the usage section. Also, I think you may need to specify anrdnameHere is a function I have in a personal package. I don’t think I’ve ever actually used the function, but
roxygenizedoes create a help file and the package passesR CMD check.