[Rcpp-devel] rcmdcheck() failing on "Undocumented S4 class" with RCPP_Module

John Clarke john.clarke at cornerstonenw.com
Fri Oct 4 12:29:26 CEST 2024


Hello all,

I'm encountering a similar problem to the one resolved (in 2017) at
the bottom of this e-mail. I'm getting the same error from
rcmdcheck(). However, my RCPP_MODULE class is in C++ (not R) and the
'@alias' solution that Dirk proposed doesn't appear to work in my
case.

In ./src/wrapper.cpp, I do something like:

RCPP_MODULE(MyModule) {
   using namespace Rcpp;
//' MyCPPClass Class
//' @name MyCPPClass
//' @title Test title MyCPPClass
//' @export
//' @description Type the name of the class to see its methods
//' @field new Constructor
//' @field mult Multiply by another Double object \itemize{
//' \item Parameter: other - The other Double object
//' \item Returns: product of the values
//' }
   class_<MyCPPClass>("MyCPPClass")

And roxygen2 generates MyCPPClass.Rd but not Rcpp_MyCPPClass.Rd (which
makes sense to me because I understand it to essentially be an alias
to MyCPPClass). However, when I run rcmdcheck() I get the following
error pertaining to Rcpp_MyCPPClass. Adding @alias or @aliases doesn't
seem to work either. rcmdcheck() appears to be looking for
Rcpp_MyCPPClass.Rd

❯ checking for missing documentation entries ... WARNING
  Undocumented S4 classes:
    ‘Rcpp_MyCPPClass’
  All user-level objects in a package (including S4 classes and methods)
  should have documentation entries.
  See chapter ‘Writing R documentation files’ in the ‘Writing R
  Extensions’ manual.

Is there a way to satisfy the documentation requirements for these
kinds of "Rcpp_" S4 classes that are (I guess) generated by RCPP?

RELATED problem and solution for reference:

On 15 August 2017 at 16:12, Luis Avila wrote:

|* I've used Roxygen to document my R classes
*|* but having problems now documenting Rcpp exposed classes from my C++ code.
*| |* I am creating .Rd files manually and that partially solves the problem but
*|* looking for a better way.
*| |* I have a module expossing c++ classes Model and NormalModel.
*|* Running R CMD check --as-cran I get:
*| |* Undocumented code objects:
*|* 'Model'
*| |* Undocumented S4 classes
*|* 'Rcpp_Model' 'Rcpp_NormalModel'
*| |* I managed to get the "undocumented code object" message to stop reporting
*|* "NormalModel" as undocumented by manually setting up a NormalModel-class.Rd
*|* file in man but can't get rid of Rcpp_NormalModel.
*
One \alias{} entry in the Rd should do. See eg the (still rather basic /
stub) page I put in for RcppAnnoy (which is just Rcpp Modules):
https://github.com/eddelbuettel/rcppannoy/blob/master/man/RcppAnnoy-package.Rd

You can write it as Rd, or you can write it in an (empty) R file to be used
by roxygen2 (though I still never let roxygen touch my NAMESPACE, DESCRIPTION
or other files -- but Rd creation I trust).

Dirk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20241004/37a91204/attachment.htm>


More information about the Rcpp-devel mailing list