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

Whit Armstrong armstrong.whit at gmail.com
Sat Oct 1 19:52:29 CEST 2011


I'm happy to provide more examples of cppbugs with inline and Rcpp.

Is there something in particular you had in mind?

-Whit


On Sat, Oct 1, 2011 at 7:05 AM, Shige Song <shigesong at gmail.com> wrote:
> Dear Whit,
>
> I have been playing with other examples you provided in the github
> repository. The one Dirt sent, however, is the only example that I can
> find from the internet showing how CppBugs works with Rcpp (and R). As
> I see it, such a combination has great potential providing a flexible
> yet powerful Bayesian computational tool.
>
> Very nice work, and thanks for the suggestion.
>
> Best,
> Shige
>
> On Fri, Sep 30, 2011 at 10:06 PM, Whit Armstrong
> <armstrong.whit at gmail.com> wrote:
>> Shige,
>>
>> That example is quite dated at this point.  The CppBugs api has
>> changed a lot since then and is likely to change more in the near
>> future.
>>
>> Please git pull the latest from github, and ping me if you have any issues.
>>
>> There are also quite a few pure c++ examples the the 'test' dir to get
>> you started.
>>
>> In the next major release of CppBugs you will be able to declare the
>> objects directly in R, but give me a few months to get that working.
>>
>> -Whit
>>
>>
>> On Fri, Sep 30, 2011 at 9:40 PM, Shige Song <shigesong at gmail.com> wrote:
>>> Dear Dirk,
>>>
>>> Thank you very much for the suggestions and the upated file. Your file
>>> actually works flawlessly on my system. It looks really interesting
>>> and educational.
>>>
>>> Thanks also for the great work on Rcpp, really amazing piece of
>>> software you got there.
>>>
>>> Best,
>>> Shige
>>>
>>> On Fri, Sep 30, 2011 at 9:11 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>>>>
>>>> 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
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>>>
>>>>
>>> _______________________________________________
>>> Rcpp-devel mailing list
>>> Rcpp-devel at lists.r-forge.r-project.org
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>>
>


More information about the Rcpp-devel mailing list