[Rcpp-devel] A simple List example that has me stumped
Rodney Sparapani
rsparapa at mcw.edu
Mon Sep 17 22:04:19 CEST 2012
On 09/17/2012 02:26 PM, Rodney Sparapani wrote:
> Hi Gang:
>
> For me, the following returns a 1 instead of a 2. Any ideas?
>
> mcmc <- list(names=list("M", "burnin", "thin", "save"),
> save=list("beta", "rho", "mu", "theta"),
> M=2, burnin=0, thin=1)
>
> check1 <- NULL
>
> check1 <- cxxfunction(signature(arg1="list", arg2="list", arg3="list"),
> body='
> List list3(arg3), save=list3["save"];
>
> const int burnin=list3["burnin"], M=list3["M"], thin=list3["thin"],
> m=save.size();
> return wrap(M);
> ',
> plugin="Rcpp")
>
> (GS <- check1(NULL, NULL, mcmc))
>
> Thanks
>
Doh!!! I get it now. That should be: M=as<int>(list3["M"])
--
Rodney Sparapani, PhD Center for Patient Care and Outcomes Research
Sr. Biostatistician http://www.mcw.edu/pcor
4 wheels good, 2 wheels better! Medical College of Wisconsin (MCW)
WWLD?: What Would Lombardi Do? Milwaukee, WI, USA
More information about the Rcpp-devel
mailing list