<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Thanks. This solves the problem! <br><br>Sent from my iPhone</div><div><br>On Jul 5, 2013, at 9:47 AM, Simon Zehnder <<a href="mailto:szehnder@uni-bonn.de">szehnder@uni-bonn.de</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=windows-1252">Hi Xiao,<div><br></div><div>I assume, that you have to use the function with its namespace R::qchisq(). The 'using namespace Rcpp;' command does not include the namespace R in which the function qchisq is defined. </div><div><br></div><div>Best</div><div><br></div><div>Simon</div><div><br></div><div><br><div><div>On Jul 5, 2013, at 6:22 PM, Xiao He <<a href="mailto:praguewatermelon@gmail.com">praguewatermelon@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,</div><div><br></div><div>I tried to call qchisq() (see mock code below). But while compiling it, I got an error message saying ` error: no matching function for call to ‘qchisq(double, double, int, int)’`. I checked this file: <a href="http://dirk.eddelbuettel.com/code/rcpp/html/Rmath_8h_source.html">http://dirk.eddelbuettel.com/code/rcpp/html/Rmath_8h_source.html</a>, and saw this: "<span style="font-size:13px;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)"> </span><span class="keywordtype" style="font-size:13px;color:rgb(96,64,32);font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">double</span><span style="font-size:13px;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)"> </span><a class="code" href="http://dirk.eddelbuettel.com/code/rcpp/html/namespaceR.html#a3a194e20767ad85ff10c659d9d0a6a74" style="font-size:13px;color:rgb(70,101,162);text-decoration:none;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">qchisq</a><span style="font-size:13px;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">(</span><span class="keywordtype" style="font-size:13px;color:rgb(96,64,32);font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">double</span><span style="font-size:13px;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)"> </span><a class="code" href="http://dirk.eddelbuettel.com/code/rcpp/html/external__pointer_8r.html#a745dfbf3bbf4ccff97d7b764f8694d25" style="font-size:13px;color:rgb(70,101,162);text-decoration:none;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">p</a><span style="font-size:13px;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">, </span><span class="keywordtype" style="font-size:13px;color:rgb(96,64,32);font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">double</span><span style="font-size:13px;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)"> </span><a class="code" href="http://dirk.eddelbuettel.com/code/rcpp/html/namespaceR.html#aa2395daa7cd108b9b8055148806e6d56" style="font-size:13px;color:rgb(70,101,162);text-decoration:none;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">df</a><span style="font-size:13px;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">, </span><span class="keywordtype" style="font-size:13px;color:rgb(96,64,32);font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">int</span><span style="font-size:13px;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)"> lt, </span><span class="keywordtype" style="font-size:13px;color:rgb(96,64,32);font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">int</span><span style="font-size:13px;font-family:monospace,fixed;line-height:13px;white-space:pre-wrap;background-color:rgb(251,252,253)"> lg)</span>" . The four arguments in the mock code also follow the double, double, int, int form. So I wonder what the problem is with my way of specifying the code. Thanks.</div>

<div><br></div><div><br></div><div><div>#include <R.h></div><div>#include <stdio.h></div><div>#include <RcppArmadillo.h></div><div>// [[Rcpp::depends(RcppArmadillo)]]</div><div><br></div><div>using namespace Rcpp;</div>

<div>using namespace arma;</div><div><br></div><div>RcppExport SEXP foo(SEXP X){</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>NumericVector x(X);</div><div><span class="Apple-tab-span" style="white-space:pre">  </span>double output = qchisq(0.5, (double)x(0), 1, 0);</div>

<div><span class="Apple-tab-span" style="white-space:pre">      </span>return(wrap(output));</div><div>}</div></div>
_______________________________________________<br>Rcpp-devel mailing list<br><a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">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">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a></blockquote></div><br></div></div></blockquote></body></html>