[Rcpp-devel] Help with an Rcpp and CppBugs example

Dirk Eddelbuettel edd at debian.org
Sat Oct 1 03:11:40 CEST 2011


Shige,

There is no way to sugarcoat this: you have to learn to live with, and learn
from, the compiler errors and relate them to the actual code. Using Rcpp
still means programming in the context of a C++ compiler.


You also need Whit's CppBugs repo from github _installed somewhere_ so that 
   
  #include <cppbugs/cppbugs.hpp>

works. Plus the same for Conrad's Armadillo as we have

  #include <armadillo>

And to top it all off, you probably need a bunch of Boost installed as
CppBugs uses it.  If all that is a given, then you can run the attached file
'whit.r' as I do below. This file served as in example in the Rcpp workshop
in April and I just fetched it from my sources. The version posted then is
likely a little outdated.  But this one works:

$ r whit.R 
Loading required package: methods
   user  system elapsed 
  0.220   0.020   0.236 
$b
[1] -0.3303790  0.5276294

$ar
[1] 0

$ 

Whether you use Rscript or r (from littler) does not matter.  The updated
whit.r is attached.  It builds and runs, I have no idea if it makes any
sense... I think it regresses y ~ X with both being noise so there.

Hope this helps,  Dirk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: whit.R
Type: application/octet-stream
Size: 1835 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110930/9326248c/attachment.obj>
-------------- next part --------------


-- 
New Rcpp master class for R and C++ integration is scheduled for 
San Francisco (Oct 8), more details / reg.info available at
http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php


More information about the Rcpp-devel mailing list