<div dir="ltr">Does round work on a matrix?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 4, 2014 at 11:53 AM, Ahmadou Dicko <span dir="ltr"><<a href="mailto:dicko.ahmadou@gmail.com" target="_blank">dicko.ahmadou@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi,<br><br></div>`round` is part of Rcpp sugar for a long time now (<a href="http://dirk.eddelbuettel.com/blog/2012/10/01/" target="_blank">http://dirk.eddelbuettel.com/blog/2012/10/01/</a>).<br>
</div>The way you use round is wrong you need to supply two arguments ('x' and 'digits'), Rcpp::round just wrap Rf_fround <br>
 (which is an alias for fround) in Rmath.h so you can check in this file the right signature.<br></div><div><div class=""><br><br>#include <Rcpp.h><br>using namespace Rcpp ;<br><br>// [[Rcpp::export]]<br></div>NumericVector h1(int samp, int wind){<br>

    return round(runif(samp*3)* wind, 0);<br><br>}<br><br><br></div><div>Hope this help<br></div><div><br><br><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Mar 4, 2014 at 11:30 AM, Hideyoshi Maeda <span dir="ltr"><<a href="mailto:hideyoshi.maeda@gmail.com" target="_blank">hideyoshi.maeda@gmail.com</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">Hi Rcpp devel list<br>
<br>
I am trying to run the following code but for some reason it says that there is "no matching function for call to ‘round’"<br>
<br>
#include <Rcpp.h><br>
using namespace Rcpp;<br>
<br>
// [[Rcpp::export]]<br>
Rcpp::IntegerVector h1(int samp, int wind){<br>
  return round(runif(samp*3)*wind);<br>
}<br>
<br>
I thought round was part of Rcpp sugar? is it not?<br>
<br>
thanks<br>
<br>
<br></div></div>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><span class="HOEnZb"><font color="#888888"><br>

</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div dir="ltr">Ahmadou H. DICKO<br>statistician economist (Ingénieur Statisticien Économiste)<br>PhD candidate in Climate change economics<br>
Faculty of economics and managment - Cheikh Anta Diop University<br>
West African Science Service Center on Climate Change and Adaptated Land Use (WASCAL)<br>Center for Development Research (ZEF) - University of Bonn <br>email : <a href="mailto:ahmadou.dicko@ucad.edu.sn" target="_blank">ahmadou.dicko@ucad.edu.sn</a><br>

twitter : @dickoah<br>github : <a href="https://github.com/dickoa" target="_blank">github/dickoa</a><br>tel : <a href="tel:%2B221%2033%20827%2055%2016" value="+221338275516" target="_blank">+221 33 827 55 16</a><br>portable: <a href="tel:%2B221%2077%20123%2081%2069" value="+221771238169" target="_blank">+221 77 123 81 69</a><br>
</div>
</font></span></div>
</blockquote></div><br></div>