Running devtools::document() gives a "Missing name" error in RccpExports.R
> devtools::document()
Updating netdist documentation
Loading netdist
Writing NAMESPACE
Warning: RcppExports.R:31: Missing name
Writing counts_from_observations.Rd
Writing emd_fast_no_smoothing.Rd
Restarting R session...
Line 31 of RcppExports.R is a NULL underneath the Roxygen docstring for the
add_element_kahan() C++ helper function in emd_fast_no_smoothing.cpp
Solution
Roxygen picks up any Roxygen docstrings (lines starting\\') from C++ functions and
copies them to RcppExports.R, whether or not their associated functions are exported to
R (using // [[Rcpp::export]] or exported from the package (using \\' @export).
However, if the function is not actually exported then there will be no function call
under the copied docstring in RcppExport.R, only NULL. As there is nothing indicating
the function name, Roxygen will give a "Missing name" error when trying to generate a
<function_name>.Rd file with the documentation from the docstring.
There are two options to fix this.
(1) Add a \\' @name <function_name> Roxygen keyword. This will give Roxygen the
information it needs to name the <function_name>.Rd file, which will be created.
(2) Remove the docstrings from non-exported C++ functions or make them normal C++
comments instead.
Problem
Running
devtools::document()
gives a "Missing name" error inRccpExports.R
Line 31 of
RcppExports.R
is aNULL
underneath the Roxygen docstring for theadd_element_kahan()
C++ helper function inemd_fast_no_smoothing.cpp
Solution
Roxygen picks up any Roxygen docstrings (lines starting
\\'
) from C++ functions and copies them toRcppExports.R
, whether or not their associated functions are exported to R (using// [[Rcpp::export]]
or exported from the package (using\\' @export
). However, if the function is not actually exported then there will be no function call under the copied docstring inRcppExport.R
, onlyNULL
. As there is nothing indicating the function name, Roxygen will give a "Missing name" error when trying to generate a<function_name>.Rd
file with the documentation from the docstring.There are two options to fix this.
(1) Add a
\\' @name <function_name>
Roxygen keyword. This will give Roxygen the information it needs to name the<function_name>.Rd
file, which will be created.(2) Remove the docstrings from non-exported C++ functions or make them normal C++ comments instead.
We have done (2).