I generate a Rcpp package using Rcpp::Rcpp.package.skeleton() or using RStudio to test using roxygen2 documentation and changed the generated test cpp function in the folder src to:
#include <Rcpp.h>
using namespace Rcpp;
//’ Testing documentation with Rcpp
//’
//’ @param x Character vector for testing
//’ @param y Numeric vector for testing more
//’
//’ @return List of x and y
//’
//’ @export
// [[Rcpp::export]]
List rcpp_hello_world(CharacterVector x,NumericVector y) {
List z = List::create( x, y ) ;
return z ;
}
I deleted the default .rd file from man, and I added Encoding: UTF-8
to the DESCRIPTION file as required by roxygen.
Then I run ctrl-shift-b (install and restart) on Rstudio
==> Rcpp::compileAttributes()
- Updated R/RcppExports.R
==> devtools::document(roclets=c('rd', 'collate', 'namespace'))
Updating testRcpp1 documentation First time using roxygen2. Upgrading automatically... Loading testRcpp1 Warning: The existing 'NAMESPACE' file was not generated by roxygen2, and will not be overwritten. Documentation completed
==> R CMD INSTALL ...
I check the man folder and the rd file is not generated, I can't find what I am doing wrong.
The sessionInfo() is :
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=es_AR.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=es_AR.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=es_AR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=es_AR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Rcpp_1.0.0 testRcpp1_1.0
loaded via a namespace (and not attached):
[1] crayon_1.3.4 withr_2.1.2 rprojroot_1.3-2 assertthat_0.2.0 R6_2.2.2 backports_1.1.2
[7] magrittr_1.5 cli_1.0.0 rlang_0.2.1 rstudioapi_0.8 testthat_2.0.1 desc_1.2.0
[13] tools_3.5.1 pkgload_1.0.2 yaml_2.1.19 compiler_3.5.1 sessioninfo_1.1.1
The problem seems to be the character you are using for comments. Your current code
//’ Testing documentation with Rcpp
//’
//’ @param x Character vector for testing
//’ @param y Numeric vector for testing more
uses ’
(which is the "right single quotation mark" character: code 146 or 0x92) rather than '
(which is the "apostrophe" character: code 39 or 0x27). The parser doesn't look for the right-handed quote symbol, only for the apostrophe. So just change to
//' Testing documentation with Rcpp
//'
//' @param x Character vector for testing
//' @param y Numeric vector for testing more