[Rcpp-devel] question from a novice
David Edwards
David.Edwards at agrsci.dk
Tue Mar 18 15:50:55 CET 2014
Sorry to bother you with a novice question, but I can't figure out why, when I try to sourceCpp (with verbose=TRUE) the code
#include <math.h> /* log */
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
double LRTrow(IntegerVector x)
{
IntegerVector y;
y = x[x>0];
double lrtc = sum(y);
if (lrtc>0) lrtc = - lrtc*log(lrtc);
for (int i=1; i<= y.size(); i++) lrtc += y[i-1]*log(y[i-1]);
return lrtc;
}
I get the error message
C:/PROGRA~1/R/R-30~1.2/library/Rcpp/include/Rcpp/internal/wrap.h:525:11: error: cannot convert 'const Rcpp::SubsetProxy<13, Rcpp::PreserveStorage, 10, true, Rcpp::sugar::Comparator_With_One_Value<13, Rcpp::sugar::greater<13>, true, Rcpp::Vector<13, Rcpp::PreserveStorage> > >' to 'SEXP' in initialization
make: *** [temp.o] Error 1
What am I doing wrong?
Best regards
David Edwards
sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
[5] LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] gRapfa_1.0 igraph_0.7.0 Rcpp_0.11.1
loaded via a namespace (and not attached):
[1] tools_3.0.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140318/a9a463cd/attachment-0001.html>
More information about the Rcpp-devel
mailing list