I have a collection of small functions that I would like to add to an R package. I list all the functions in a single file, preceeded for each by Roxygen2 indications for building the help file (an example below). It all works well. However, I noted that when I rename that file to begin with an underscore (so that it appears first in my list of files), I get the following error message:
Updating mypackage documentation
Loading mypackage
Writing NAMESPACE
Writing NAMESPACE
Warning message:
In setup_ns_exports(path, export_all, export_imports) :
Objects listed as exports, but not present in namespace: a, b
Here is the content of the only file in the R subfolder:
#' @name a
#' @title the a() function does etc.
#' @description etc.
#' @param x a dataframe containing etc.;
#' @param v a vector containing etc..
#' @return a dataframe of the etc.
#' @export a
a <- function(x, v) { return("somevalue") }
#' @name b
#' @title the b() function does etc.
#' @description etc.
#' @param x a dataframe containing etc.;
#' @param v a vector containing etc..
#' @return a dataframe of the etc.
#' @export b
b <- function(x, v) { return("some other value") }
When I remove the underscore, and re-run devtools::document() twice, the error message disapear. I put back the underscore and the error is back. When there is no Roxygen2 tags, there are no error and the functions work nice.
Is this a normal behavior? Is there a way around this error or should I just give up the idea of using the underscore?