Re: [Rcpp-devel] Call R function

2012-06-21 Thread Douglas Bates
On Wed, Jun 20, 2012 at 4:30 PM, bbo...@tin.it wrote: > > i must use it to evaluate  matropolis ratio (green ratio) in the following > code in R :  i have  start just  now to study c and c++   (like you can see > by my stupids questions (for you surely))  if  you have some suggestion im > very hap

Re: [Rcpp-devel] Call R function (bbo...@tin.it)

2012-06-20 Thread Douglas Bates
On Wed, Jun 20, 2012 at 11:22 AM, Silkworth,David J. wrote: > I am not going to ask why to do this, but here is a way how. > > I added your R function into the mypackage skeleton from RcppPackage > > R_user_F<-function (par) { > y<-par[1] > x<-par[2] > return(dnorm(x)*dnorm(y)) > } > > I prefer to

Re: [Rcpp-devel] Call R function (bbo...@tin.it)

2012-06-20 Thread Silkworth,David J.
I am not going to ask why to do this, but here is a way how. I added your R function into the mypackage skeleton from RcppPackage R_user_F<-function (par) { y<-par[1] x<-par[2] return(dnorm(x)*dnorm(y)) } I prefer to use the explicit return function for clarity. Now I install the package after

Re: [Rcpp-devel] Call R function

2012-06-20 Thread Douglas Bates
I enclose a rewrite of your function R version 2.15.0 (2012-03-30) Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain con

Re: [Rcpp-devel] Call R function

2012-06-20 Thread Douglas Bates
On Wed, Jun 20, 2012 at 12:52 AM, bbo...@tin.it wrote: > Hello i would like to compute the following code ; > > Where R_user_F is a R function  (i could write this function directly inin > line but is only for example because i want to call an R function more > complex): > so when compile appear t

[Rcpp-devel] Call R function

2012-06-19 Thread bbo...@tin.it
Hello i would like to compute the following code ; Where R_user_F is a R function (i could write this function directly inin line but is only for example because i want to call an R function more complex): so when compile appear this error message: error: "cannot convert 'Rcpp::sugar::Compar