Hello again,<br><br>"And had you posted reproducible examples we could have told you that days<br>
ago."<br><br>That it is true. But I think I learned more about Rcpp this way. <br>Also, I definitely learned more about how inline works than had I followed more instructions.<br>Moreover, having seen the sheer amount of stupid mistakes I had made in my first attempts, as I subsequently worked through them, I can't really say I regret not inflicting all of them on you.<br>
<br>Thank you for that example, Dirk. That is exactly what I aspire to, Whit, nice code.<br><br>This is a really useful facility. I have something I can start using, and there is loads of room for me to build something really solid with packages or whatever.<br>
<br>Good stuff lads.<br><br>Thanks again.<br><br>Simon<br><br><br><div class="gmail_quote">On Wed, Oct 12, 2011 at 3:32 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org">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 12 October 2011 at 14:51, Simon Fuller wrote:<br>
| Hello,<br>
|<br>
| We cross-posted. Yes, you're right. I misunderstood the use of includes -<br>
<br>
</div>And had you posted reproducible examples we could have told you that days<br>
ago.<br>
<br>
Have a look at the recent post by Whit Armstrong about his updated CppBugs<br>
example -- that does just that: mix with other classes.<br>
<font color="#888888"><br>
Dirk<br>
</font><div><div></div><div class="h5"><br>
| global - that is a good way of thinking about it.<br>
|<br>
| Thanks for everything.<br>
|<br>
| Simon<br>
|<br>
| On Wed, Oct 12, 2011 at 2:06 PM, Darren Cook <<a href="mailto:darren@dcook.org">darren@dcook.org</a>> wrote:<br>
|<br>
| > pertain to packages. So I will post the relevant code here, and the full<br>
| > output from verbose=TRUE below it:<br>
|<br>
| I think the verbose output was missing from your email (?).<br>
|<br>
| > linktest<-cxxfunction( signature( vec = "numeric", len = "integer" ),<br>
| paste(<br>
| > readLines(<br>
| > "/home/simon/College/PackageOne/src/BZip/LinkTestWrap.cpp"),collapse = "\<br>
| n"<br>
| > ) , plugin = "Rcpp",verbose=TRUE )<br>
| > ...<br>
|<br>
| > 2. LinkTestWrap.cpp: Rcpp Wrapping Function (for use by inline)<br>
| > #include <Rcpp.h><br>
| > #include <vector><br>
| > #include "/home/simon/College/PackageOne/src/BZip/LinkTest.h"<br>
| ><br>
| > using std::vector;<br>
| ><br>
| > vector<int> input_vector( as< vector<int> >( vec ) );<br>
| > int length = as<int> ( len );<br>
| ><br>
| > int res = sumvec( input_vector );<br>
| ><br>
| > return Rcpp::wrap( res );<br>
|<br>
| Does this mean you have three #include statements inside your function<br>
| body? The cxxfunction has an includes parameter where you should put<br>
| them. I think of "includes" as meaning "global stuff". So you could put<br>
| your "using std::vector" line in there too (that is just a style<br>
| difference, though).<br>
|<br>
| Also, IIRC, plugin="Rcpp" implies the #include <Rcpp.h>, so you should<br>
| be able to drop that.<br>
|<br>
| Darren<br>
|<br>
| --<br>
| Darren Cook, Software Researcher/Developer<br>
|<br>
| <a href="http://dcook.org/work/" target="_blank">http://dcook.org/work/</a> (About me and my work)<br>
| <a href="http://dcook.org/blogs.html" target="_blank">http://dcook.org/blogs.html</a> (My blogs and articles)<br>
| _______________________________________________<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>
|<br>
|<br>
|<br>
</div></div>| ----------------------------------------------------------------------<br>
<div class="im">| _______________________________________________<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><div></div><div class="h5">--<br>
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too<br>
dark to read." -- Groucho Marx<br>
</div></div></blockquote></div><br>