0

I do not need roxygen2 and Rcpp to create for me the R functions (or maybe I do?) for the exported C++ functions - is there any way to tell Rcpp::export not to create them? I would be perfectly happy with just .Call-ing them directly.

I went through Writing R Extensions, and Rcpp Attributes and Writing a package that uses Rcpp vignettes, documentation of roxygen2 and multiple threads on SO (like here) but I did not find anything helpful.

Community
  • 1
  • 1
Tim
  • 7,075
  • 6
  • 29
  • 58

1 Answers1

2

If I understand your question correctly, then it is as simple "well if you don't want a stub function created, do no put an [[Rcpp::export]] tag there".

You also confuse what roxygen2 does for documentation with what the compileAttributes() function does for exporting.

To be plain, only the latter has anything to do with creating interfaces between R and C++. And on the margin, you do want them for the free exception handling and RNG setting they give you. But hey, if you'd rather do without, you can, and that is documented.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Thanks, but I always thought that I need to `[[Rcpp::export]]` so Rcpp does the proper translations of R objects into C++ ones..? Can I directly call something like `NumericVector foo(NumericVectorr x) { return x+1; } ` using `.Call` without exporting it ? – Tim Jan 31 '17 at 17:00
  • You appear to be confusing several issues. The translation is done by the C++ code in the package, not by transformations done by `compileAttributes()` when tickled by `[[Rcpp::export]]`. Rcpp Attributes mostly just adds a lot of (rather helpful !!) glue code, extending what package [inline](https://cran.r-project.org/package=inline) did before. You are not forced to use any of these, but I suspect the advantages these offer will compel you to use them--as they do for other people. Maybe you can claridy your question. – Dirk Eddelbuettel Jan 31 '17 at 17:11
  • And/or just _look_ at some other packages. There are well over 900 on CRAN now, just poke around. Many have internal helper functions in C++ without export tags. – Dirk Eddelbuettel Jan 31 '17 at 17:19
  • Thanks. I will stick to standard Rcpp, I was just curious if I can resign from the R functions I didn't need. – Tim Jan 31 '17 at 19:08