I want to add a infix function to a package but the %%
s challenge me.
I found this solution but unfortunately it doesn't explain where exactly the line export("%IN%")
should be added. I didn't get any smarter from that question either. Since the questions are five years old I decided to ask a new question.
Consider the same function as in the first linked question.
"%IN%" <- function(x, table) x & match(x, table, nomatch = 0) > 0
I usually add a new function to my package writing a <myfun>_function.R
file according to this rough template.
#' Title
#'
#' \code{%IN%} does this and that
#' @param x texttext
#' @param table texttext
#' @return texttext
#' @export
#' @examples
#' 1:5 %IN% 1:3
"%IN%" <- function(x, table) x & match(x, table, nomatch = 0) > 0
Accordingly I'd save a file named "`%IN%`_function.R"
to the R
folder of my package directory X
.
Then in setwd("./X")
I run these lines of code
library(digest)
R.utils::reassignInPackage("digest", "digest", mydigest)
roxygen2::roxygenize()
(Where I got mydigest
from there).
At the end in the terminal I create the package with R CMD build X
.
So, where exactly is the export("%IN%")
line to be added?