You need to escape the %
s in the usage section. Also, I think you may need to specify an rdname
#' 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
#' @rdname nin
"%nin%" <- function(x, y) {
return( !(x %in% y) )
}
Here is a function I have in a personal package. I don't think I've ever actually used the function, but roxygenize
does create a help file and the package passes R CMD check
.
#' percent in
#'
#' calculate the percentage of elements of \code{table} that are in \code{x}
#'
#' @param x vector or NULL: the values to be matched
#' @param table vector or NULL: the values to be matched against
#' @return percentage of elements of \code{x} that are in \code{table}
#' @author gsee
#' @usage x \%pctin\% table
#' @examples
#' letters[1:10] %pctin% letters[1:3] # 30% of the second arg ar in the first
#' @export
#' @rdname PctIn
"%pctin%" <- function(x, table) length(x[x %in% table])/length(x)