Discussion:
[Rcpp-devel] best way of documenting Rcpp Modules
Luis Avila
2017-08-15 23:12:07 UTC
Permalink
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.

Is there a way to hide the classes with the Rcpp suffix, or what is the
recommended way to fix this problem?

Thank you.

Luis
Hao Ye
2017-08-16 01:12:30 UTC
Permalink
Hi Luis,

I recall having this problem, and I, too, had solved it by creating .Rd
files for the c++ class objects.

I don't have this error anymore, and I believe the main difference is that
I am curating my NAMESPACE file manually to only export the R functions
instead of everything ~ `exportPattern("^[[:alpha:]]+")`

You may want to give that a try.

If that doesn't work, it would help to see this issue as a minimal
reproducible example, e.g. a link to a GitHub repo.

Best,
--
Hao Ye
Post by Luis Avila
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.
'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.
Is there a way to hide the classes with the Rcpp suffix, or what is the
recommended way to fix this problem?
Thank you.
Luis
Dirk Eddelbuettel
2017-08-16 01:41:29 UTC
Permalink
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
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Loading...