I am trying to add a binary operator function to my package, but this is not loading the package. for example, I define this function and save it as a file named "wo.R"
`%wo%` <- function(x, y) { x[!x %in% y] }
and create the documentation file "wo.Rd"
\name{\%wo\%} \alias{\%wo\%} \title{Without} \description{Elements in one vector without matching elements in a second vector.} \usage{x \%wo\% y} \arguments{ \item{x}{A vector.} \item{y}{A vector.} } \value{A vector.} \author{me, based on example in the \code{\link{match}} function documentation.} \examples{ (1:10) \%wo\% c(3,7,12) }
when I run R CMD check myPackage
, it gives this error when checking the sample documentation: Error: could not find function "%wo%" Execution halted
. I can remove the example and successfully install my package, but the% wo% function does not load with my package. I can create a wo.R file in an R session and it works. I can also define the function as wo <- function(x, y) x[!x %in% y]
and it seems to work fine. I poked the source code for other packages, such as "statements", and my source files and documentation files look compatible with them, but I obviously miss something.
source share