[Rcpp-devel] Cppbugs - help

Dirk Eddelbuettel edd at debian.org
Sat Aug 2 23:23:57 CEST 2014


On 2 August 2014 at 15:34, tony nwankwo wrote:
| I have been trying to use inline with Armstrong's cppbugs - no success !! Does anyone got a working example - I am using Windows 8.

The git sources of cppbugs ship with an example for use with inline, see the
directory test/r.inline.example/ .

This example script works out of the box for me:

   edd at max:~/git/cppbugs/test/r.inline.example$ Rscript run.cppbugs.r 
   Loading required package: inline
   Loading required package: methods
   Loading required package: Rcpp
   
   Attaching package: ‘Rcpp’
   
   The following object is masked from ‘package:inline’:
   
       registerPlugin
   
   actual vs estimated:
           actual estimated
   [1,] 10.000000 10.034211
   [2,] -0.253434 -0.236289
   [3,] -0.938146 -0.947969
   [4,] -0.411832 -0.384918
   [5,]  0.283826  0.315746
   [6,]  2.446334  2.491062
   ar: 0.199885 
   R^2: 0.881294 
   edd at max:~/git/cppbugs/test/r.inline.example$

One caveat though:  Whit's setup depends on   #include <cppbugs/cppbugs.h>
working "as is". I facilitated this (apparently years ago) with a softlink
which points /usr/local/include/cppbugs to the corresponding directory in the
gitrepo.  You would have to do something similar under Windows, but I have no
idea what that would be.  Alternatively, change the code to  
#include "cppbugs/cppbugs.h"  and copy the cppbugs/ directory and content to
your current working directory.

Two final remarks: You probably want to read the 'Rcpp Attributes' vignette
and switch from inline to Attributes, they are both easier and more powerful.

And you may want to look into his CRAN package 'rcppbugs', which we may want
to change to using inst/include/ instead of src so that 
  // [[Rcpp::depends(rcppbugs)]] 
works ...

Dirk

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


More information about the Rcpp-devel mailing list