[Rcpp-devel] Bug: compileAttributes incorrectly handles Rcpp::export-ed functions with multiple arguments

Dirk Eddelbuettel edd at debian.org
Sat Jan 18 01:18:40 CET 2014

On 17 January 2014 at 15:32, Davor Cubranic wrote:
| On 2014-01-17, at 2:55 PM, Dirk Eddelbuettel wrote:
| > You had two mistakes here:
| > 
| >  i)   after you alter an interface to be used by Rcpp Attributes, you must
| >       re-run the compileAttributes() function to update the files.  See the
| >       vignette for details.
| What do you mean by this? Like I said, I changed the .cpp file and re-run
|  compileAttributes. What I uploaded is the result afterwards.

The equivalent of 
    $ cd myPackage; R -e 'Rcpp::compileAttributes(".")'

For once, I launched R and typed it by hand.
| >       (And if you use RStudio, this is done automagically)
| So it is by devtools, on one of the functions I regularly use in my workflow, perhaps "test". If it wasn't, it would be such a pain.
| >  ii)  Your C++ function did not work as the 'List z = ...' parameter
| >       shadowed an already declared parameter from the function interface.
| >       Renaming to zz or z2 works, of course.
| I fixed it and rerun compileAttributes. Still the same problem. New version of the package is attached.

See here, based on your previous file.

edd at max:/tmp/davor/myPackage$ cat src/rcpp_hello_world.cpp 

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
List rcpp_hello_world(NumericVector z) {
    CharacterVector x = CharacterVector::create( "foo", "bar" )  ;
    NumericVector y   = NumericVector::create( 0.0, 1.0 ) ;
    List z2           = List::create( x, y ) ;
    return z2 ;
edd at max:/tmp/davor/myPackage$ R CMD check .
* using log directory ‘/tmp/davor/myPackage/..Rcheck’
* using R version 3.0.2 (2013-09-25)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘./DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘myPackage’ version ‘1.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... NOTE
Found the following hidden files and directories:
These were most likely included in error. See section ‘Package structure’ in the ‘Writing R Extensions’ manual.
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘myPackage’ can be installed ... WARNING
Found the following significant warnings:
  Warning: /tmp/davor/myPackage/man/myPackage-package.Rd:31: All text must be in a section
  Warning: /tmp/davor/myPackage/man/myPackage-package.Rd:32: All text must be in a section
See ‘/tmp/davor/myPackage/..Rcheck/00install.out’ for details.
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... WARNING
Non-standard license specification:
  What Licence is it under ?
Standardizable: FALSE
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... WARNING
Found the following directory with the name of a check directory:
Most likely, these were included erroneously.
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... WARNING
prepare_Rd: myPackage-package.Rd:31: All text must be in a section
prepare_Rd: myPackage-package.Rd:32: All text must be in a section
prepare_Rd: myPackage-package.Rd:38-40: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... WARNING
Unknown package ‘<pkg>’ in Rd xrefs
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... WARNING
Codoc mismatches from documentation object 'rcpp_hello_world':
  Code: function(z)
  Docs: function()
  Argument names in code not in docs:

* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking compiled code ... OK
* checking examples ... OK
* checking PDF version of manual ... OK

WARNING: There were 6 warnings.
NOTE: There was 1 note.
for details.

edd at max:/tmp/davor/myPackage$ 

Hope this help,  Dirk

Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

More information about the Rcpp-devel mailing list