Yes, that fixes the problem. <div><br></div><div>Apologies and thanks,</div><div>Chris<br><div><div><div><br><div class="gmail_quote">On Fri, Aug 12, 2011 at 7:59 AM, 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;"><br>
Got it now: you cannot just drop code in an R file, that has nothing to do<br>
with Rcpp methinks. Wrap it in a function like so:<br>
<div class="im"><br>
edd@max:/tmp$ R CMD INSTALL chrisExample/<br>
* installing to library ‘/usr/local/lib/R/site-library’<br>
* installing *source* package ‘chrisExample’ ...<br>
</div><div class="im">** libs<br>
make: Nothing to be done for `all'.<br>
</div>installing to /usr/local/lib/R/site-library/chrisExample/libs<br>
<div class="im">** R<br>
** preparing package for lazy loading<br>
** help<br>
</div>Warning: /tmp/chrisExample/man/chrisExample-package.Rd:32: All text must be in a section<br>
Warning: /tmp/chrisExample/man/chrisExample-package.Rd:33: All text must be in a section<br>
<div class="im">*** installing help indices<br>
** building package indices ...<br>
** testing if installed package can be loaded<br>
<br>
</div>* DONE (chrisExample)<br>
edd@max:/tmp$ r -lchrisExample -e'chris()'<br>
C++ class 'World' <0x2a55d60><br>
Constructors:<br>
World()<br>
<br>
Fields: No public fields exposed by this class<br>
<br>
Methods:<br>
std::string greet()<br>
docstring : get the message<br>
void set(std::string)<br>
docstring : set the message<br>
edd@max:/tmp$ cat chrisExample/R/rcpp_hello_world2.R<br>
<br>
chris <- function() {<br>
<div class="im"> show(World)<br>
b <- new(World)<br>
b$greet()<br>
b$set("hello everybody")<br>
b$greet()<br>
rm(b)<br>
<br>
</div> invisible(NULL)<br>
}<br>
edd@max:/tmp$<br>
<br>
Ok?<br>
<br>
Dirk<br>
<font color="#888888"><br>
--<br>
</font><div><div></div><div class="h5">Two new Rcpp master classes for R and C++ integration scheduled for<br>
New York (Sep 24) and San Francisco (Oct 8), more details are at<br>
<a href="http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10" target="_blank">http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10</a><br>
<a href="http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php" target="_blank">http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php</a><br>
</div></div></blockquote></div><br></div></div></div></div>