Thanks :-)<br><br>Just for full information this is the content of my object:<br><br> vector<double> nav;<br> vector< vector<double> > cashFlows;<br> string creationDate;<br> string activationDate;<br>
string finalDate;<br> string benchmark;<br> vector<string> dates;<br> vector<string> datesBmk;<br> vector< vector<double> > indexesBmk;<br> vector< vector<double> > weightsBmk;<br>
double start;<br> string type;<br><br>Are those objects automatically wrapped by Rcpp ?<br><br>My environment is Linux Ubuntu 32 bit with R version 2.11.1 (2010-05-31).<br>Do you need more info ?<br><br>Thanks in advance,<br>
Alex<br><br><div class="gmail_quote">On Fri, Sep 24, 2010 at 1:18 PM, Romain Francois <span dir="ltr"><<a href="mailto:romain@r-enthusiasts.com">romain@r-enthusiasts.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Le 24/09/10 13:07, Alessandro Torrisi a écrit :<div class="im"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi!<br>
<br>
I'm new to the group, to rcpp and to C++ also :-P<br>
</blockquote>
<br></div>
welcome.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I'm trying to embed R in a little program which loads a txt file, parses<br>
it into an object and calls a function developed by our R coders.<br>
<br>
What I aim to do is to move one of our actual Java procedures (built on<br>
Java/Rserve architecture) to C++/RInside/Rcpp, I think we could have lot<br>
of improvements in this way.<br>
<br>
This is a snippet of the procedure:<br>
<br>
R["nav_in"] = Rcpp::wrap(input.nav);<br>
R["cashFlows_in"] = Rcpp::wrap(input.cashFlows);<br>
R["dates_in"] = Rcpp::wrap(input.dates);<br>
R["indexesBmk_in"] = Rcpp::wrap(input.indexesBmk);<br>
R["weightsBmk_in"] = Rcpp::wrap(input.weightsBmk);<br>
R["benchmark_in"] = Rcpp::wrap(input.benchmark);<br>
R["datesBmk_in"] = Rcpp::wrap(input.datesBmk);<br>
R["creationDate_in"] = Rcpp::wrap(input.creationDate);<br>
R["activationDate_in"] = Rcpp::wrap(input.activationDate);<br>
R["finalDate_in"] = Rcpp::wrap(input.finalDate);<br>
R["start_in"] = Rcpp::wrap(input.start);<br>
R["type_in"] = Rcpp::wrap(input.type);<br>
</blockquote>
<br></div>
I think the Rcpp::wrap is redundant, you could e.g. write :<br>
<br>
R["nav_in"] = input.nav ;<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
SEXP res;<br>
<br>
string evalstr = "res <- portfolioBenchmark(nav_in, cashFlows_in,<br>
dates_in, indexesBmk_in, weightsBmk_in, benchmark_in, datesBmk_in,<br>
creationDate_in, activationDate_in, finalDate_in, start_in, type_in); res";<br>
res = R.parseEval(evalstr);<br>
<br>
What I obtain is the following:<br>
<br>
Errore in .Call("R_isMethodsDispatchOn", onOff, PACKAGE = "base");<br>
Numero di argomenti errato (2), ce ne vogliono 1 per<br>
R_isMethodsDispatchOn<br>
terminate called after throwing an instance of 'Rcpp::binding_not_found'<br>
what(): binding not found: '.AutoloadEnv'<br>
Aborted<br>
<br>
Excuse for the message, which is an Italian/English mix...<br>
What is this error about ?<br>
</blockquote>
<br></div>
Which platform are you using ?<br>
<br>
There seem to be an initialization problem, which I think I have only seen on windows so far, hence my question.<div class="im"><br>
<br>
And then... the result of the<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
"portfolioBenchmark" function should be a list..How can I convert the<br>
returned SEXP res into a list ?<br>
</blockquote>
<br></div>
You could do this I suppose:<br>
<br>
Rcpp::List mylist( res ) ;<div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Thanks in advance,<br>
Alessandro Torrisi.<br>
</blockquote>
<br>
<br></div></div><font color="#888888">
-- <br>
Romain Francois<br>
Professional R Enthusiast<br>
+33(0) 6 28 91 30 30<br>
<a href="http://romainfrancois.blog.free.fr" target="_blank">http://romainfrancois.blog.free.fr</a><br>
|- <a href="http://bit.ly/cCmbgg" target="_blank">http://bit.ly/cCmbgg</a> : Rcpp 0.8.6<br>
|- <a href="http://bit.ly/bzoWrs" target="_blank">http://bit.ly/bzoWrs</a> : Rcpp svn revision 2000<br>
`- <a href="http://bit.ly/b8VNE2" target="_blank">http://bit.ly/b8VNE2</a> : Rcpp at LondonR, oct 5th<br>
<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Alessandro Torrisi<br>Information Technology Consultant<br>Email: <a href="mailto:alessandro.torrisi@gmail.com">alessandro.torrisi@gmail.com</a><br>Skype: alessandro.torrisi<br>
Tel: +39/333/2442546<br><br>"Questo documento è formato esclusivamente per il destinatario. Tutte le informazioni ivi contenute, compresi eventuali allegati, sono soggette a riservatezza a termini del vigente D.Lgs. 196/2003 in materia di "privacy" e quindi ne è proibita l'utilizzazione. Se avete ricevuto per errore questo messaggio, Vi preghiamo cortesemente di contattare immediatamente il mittente e cancellare la e-mail. Grazie."<br>