Try;<br><br>require(Rcpp)<br>require(inline)<br><br>check2 <- cxxfunction(signature(arg1 = "numeric", arg2 = "numeric"), '<br>                NumericVector q(arg1);<br>                double mean = as<double>(arg2);<br>

                double sd = 1.0;<br><br>                return wrap(qnorm(q, mean, sd));<br>                ', plugin = "Rcpp")<br><br>output;<br><br>> check2 <- cxxfunction(signature(arg1 = "numeric", arg2 = "numeric"), '<br>

+                 NumericVector q(arg1);<br>+                 double mean = as<double>(arg2);<br>+                 double sd = 1.0;<br>+ <br>+                 return wrap(qnorm(q, mean, sd));<br>+                 ', plugin = "Rcpp")<br>

> check2(0.5, 0.5)<br>[1] 0.5<br><br><br><br><div class="gmail_quote">On Mon, Sep 10, 2012 at 4:35 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 10 September 2012 at 10:23, Rodney Sparapani wrote:<br>
| On 09/07/2012 12:19 PM, Dirk Eddelbuettel wrote:<br>
| > Make that   Rcpp::NumericVector a = Rcpp::NumericVector(arg1);  and things<br>
| > will just work.<br>
| ><br>
| > Would be nice if the compiler messahes could be more helpful...   All sugar<br>
| > functions are vectorised, so you must feed them a vector (which, as we work<br>
| > with R, may well be of length 1 if you so choose....)<br>
| ><br>
| > Dirk<br>
|<br>
| Thank you Dirk!  But, I seem to keep messing this up.  Could you take a<br>
| look at this?<br>
<br>
</div>Please look at the two emails I sent in this thread on Sep 7.<br>
<br>
Dirk<br>
<div class="HOEnZb"><div class="h5"><br>
|<br>
| require(Rcpp)<br>
| require(inline)<br>
|<br>
| str <- '<br>
| double x=as<double>(qnorm(as<NumericVector>(arg1),<br>
| as<NumericVector>(arg2), as<NumericVector>(1.))[0]);<br>
| return wrap(x);<br>
| '<br>
|<br>
| check2 <- cxxfunction(signature(arg1="numeric", arg2="numeric"), str,<br>
| plugin="Rcpp")<br>
|<br>
| check2(0.5, 0.5)<br>
|<br>
| ...<br>
|<br>
|   31: double x=as<double>(qnorm(as<NumericVector>(arg1),<br>
| as<NumericVector>(arg2), as<NumericVector>(1.))[0]);<br>
|   32: return wrap(x);<br>
|   33:<br>
|   34: END_RCPP<br>
|   35: }<br>
|   36:<br>
|   37:<br>
| Error in compileCode(f, code, language = language, verbose = verbose) :<br>
|    Compilation ERROR, function(s)/method(s) not created!<br>
| file1a785d3ff187.cpp: In function 'SEXPREC* file1a785d3ff187(SEXPREC*,<br>
| SEXPREC*)':<br>
| file1a785d3ff187.cpp:31: error: no matching function for call to<br>
| 'as(double)'<br>
| make: *** [file1a785d3ff187.o] Error 1<br>
| In addition: Warning message:<br>
| running command '/opt/local/lib64/R/bin/R CMD SHLIB file1a785d3ff187.cpp<br>
| 2> file1a785d3ff187.cpp.err.txt' had status 1<br>
|<br>
| --<br>
| Rodney Sparapani, PhD  Center for Patient Care and Outcomes Research<br>
| Sr. Biostatistician               <a href="http://www.mcw.edu/pcor" target="_blank">http://www.mcw.edu/pcor</a><br>
| 4 wheels good, 2 wheels better!   Medical College of Wisconsin (MCW)<br>
| WWLD?:  What Would Lombardi Do?   Milwaukee, WI, USA<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<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" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</div></div></blockquote></div><br>