[Rcpp-devel] round function not found?

Simon Zehnder szehnder at uni-bonn.de
Tue Mar 4 12:54:47 CET 2014


Hideyoshi,

following http://dirk.eddelbuettel.com/blog/2012/10/01/, this should work though. 

Also using the inline package I get the correct result:

src <- 'return Rcpp::wrap(round(3.2));’
cfunc <- cxxfunction(body = src, plugin = "Rcpp”)

cfunc()
[1] 3

Best

Simon


On 04 Mar 2014, at 12:30, 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



More information about the Rcpp-devel mailing list