[Rcpp-devel] Function arguments to R

Dirk Eddelbuettel edd at debian.org
Mon May 4 03:04:15 CEST 2015


On 3 May 2015 at 16:41, Sören Vogel wrote:
| Hello
| 
| I have created a function that I want to expose to R in my package using Rcpp modules:
| 
| #include <Rcpp.h>
| using namespace Rcpp;
| void myfun( Rcpp::List lst, NumericVector vec ) {
| 	// do something
| }
| RCPP_MODULE(mymod) {
| 	function("myfun", &myfun, "Does something.");
| }
| 
| The documentation file (Rd) of the function list the two formal arguments, lst and vec. However, R CMD CHECK says:
| 
| * checking for code/documentation mismatches ... WARNING
| Codoc mismatches from documentation object 'myfun':
| myfun
|   Code: function(...)
|   Docs: function(lst, vec)
|   Argument names in code not in docs:
|     ...
|   Argument names in docs not in code:
|     lst vec
|   Mismatches in argument names:
|     Position: 1 Code: ... Docs: lst
| 
| How can I fix this?

Not to sound too flippant but if code and doc are amiss, you could fix either
the doc side, or the code side:

 i)   don't document in Rd

 ii)  export myfun() by adding   // [[Rcpp::export]]    above it

There is simply no formal connection between Modules and Rd files.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list