[Rcpp-devel] Bug when using #' @title Hello world

Dieter Menne dieter.menne at menne-biomed.de
Wed Feb 26 17:30:58 CET 2014


JJ Allaire wrote:

>>Try locating the roxygen right above the function you want to document (rcpp_hello_world). If you do that then it will be placed next to that function in the .R file (when you have "standalone" roxygen within a C++ file then it's automatically associated with a NULL object in the .R file).>>

Thanks a lot, JJ, problem solved. For the record: It should be above the [[Rcpp:export]]. When you put it above the List rcppp..., which I had tried, it also fails.

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
//' @title Hello world
List rcpp_hello_world() {
   
    CharacterVector x = CharacterVector::create( "foo", "bar" )  ;
    NumericVector y   = NumericVector::create( 0.0, 1.0 ) ;
    List z            = List::create( x, y ) ;
    
    return z ;
} 

Dieter









More information about the Rcpp-devel mailing list