Hello again,<br><br>&quot;And had you posted reproducible examples we could have told you that days<br>
ago.&quot;<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&#39;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">&lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt;</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&#39;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 &lt;<a href="mailto:darren@dcook.org">darren@dcook.org</a>&gt; wrote:<br>
|<br>
|     &gt; pertain to packages. So I will post the relevant code here, and the full<br>
|     &gt; output from verbose=TRUE below it:<br>
|<br>
|     I think the verbose output was missing from your email (?).<br>
|<br>
|     &gt; linktest&lt;-cxxfunction( signature( vec = &quot;numeric&quot;, len = &quot;integer&quot; ),<br>
|     paste(<br>
|     &gt; readLines(<br>
|     &gt; &quot;/home/simon/College/PackageOne/src/BZip/LinkTestWrap.cpp&quot;),collapse = &quot;\<br>
|     n&quot;<br>
|     &gt; ) , plugin = &quot;Rcpp&quot;,verbose=TRUE )<br>
|     &gt; ...<br>
|<br>
|     &gt; 2. LinkTestWrap.cpp: Rcpp Wrapping Function (for use by inline)<br>
|     &gt; #include &lt;Rcpp.h&gt;<br>
|     &gt; #include &lt;vector&gt;<br>
|     &gt; #include &quot;/home/simon/College/PackageOne/src/BZip/LinkTest.h&quot;<br>
|     &gt;<br>
|     &gt;     using std::vector;<br>
|     &gt;<br>
|     &gt;     vector&lt;int&gt; input_vector( as&lt; vector&lt;int&gt; &gt;( vec ) );<br>
|     &gt;     int length = as&lt;int&gt; ( len );<br>
|     &gt;<br>
|     &gt;     int res = sumvec( input_vector );<br>
|     &gt;<br>
|     &gt;     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 &quot;includes&quot; as meaning &quot;global stuff&quot;. So you could put<br>
|     your &quot;using std::vector&quot; line in there too (that is just a style<br>
|     difference, though).<br>
|<br>
|     Also, IIRC, plugin=&quot;Rcpp&quot; implies the #include &lt;Rcpp.h&gt;, 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>
&quot;Outside of a dog, a book is a man&#39;s best friend. Inside of a dog, it is too<br>
dark to read.&quot; -- Groucho Marx<br>
</div></div></blockquote></div><br>