[Rcpp-devel] round function not found?

Ahmadou Dicko dicko.ahmadou at gmail.com
Tue Mar 4 12:53:16 CET 2014


Hi,

`round` is part of Rcpp sugar for a long time now (
http://dirk.eddelbuettel.com/blog/2012/10/01/).
The way you use round is wrong you need to supply two arguments ('x' and
'digits'), Rcpp::round just wrap Rf_fround
 (which is an alias for fround) in Rmath.h so you can check in this file
the right signature.


#include <Rcpp.h>
using namespace Rcpp ;

// [[Rcpp::export]]
NumericVector h1(int samp, int wind){
    return round(runif(samp*3)* wind, 0);

}


Hope this help





On Tue, Mar 4, 2014 at 11:30 AM, Hideyoshi Maeda
<hideyoshi.maeda at gmail.com>wrote:

> Hi Rcpp devel list
>
> I am trying to run the following code but for some reason it says that
> there is "no matching function for call to 'round'"
>
> #include <Rcpp.h>
> using namespace Rcpp;
>
> // [[Rcpp::export]]
> Rcpp::IntegerVector h1(int samp, int wind){
>   return round(runif(samp*3)*wind);
> }
>
> I thought round was part of Rcpp sugar? is it not?
>
> thanks
>
>
> _______________________________________________
> 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
>



-- 
Ahmadou H. DICKO
statistician economist (Ingénieur Statisticien Économiste)
PhD candidate in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land
Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
email : ahmadou.dicko at ucad.edu.sn
twitter : @dickoah
github : github/dickoa <https://github.com/dickoa>
tel : +221 33 827 55 16
portable: +221 77 123 81 69
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140304/37591cff/attachment.html>


More information about the Rcpp-devel mailing list