Got it now: you cannot just drop code in an R file, that has nothing to do
with Rcpp methinks. Wrap it in a function like so:
edd@max:/tmp$ R CMD INSTALL chrisExample/
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘chrisExample’ ...
** libs
make: Nothing to be done for `all'.
installing to /usr/local/lib/R/site-library/chrisExample/libs
** R
** preparing package for lazy loading
** help
Warning: /tmp/chrisExample/man/chrisExample-package.Rd:32: All text must be in
a section
Warning: /tmp/chrisExample/man/chrisExample-package.Rd:33: All text must be in
a section
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
* DONE (chrisExample)
edd@max:/tmp$ r -lchrisExample -e'chris()'
C++ class 'World' <0x2a55d60>
Constructors:
World()
Fields: No public fields exposed by this class
Methods:
std::string greet()
docstring : get the message
void set(std::string)
docstring : set the message
edd@max:/tmp$ cat chrisExample/R/rcpp_hello_world2.R
chris <- function() {
show(World)
b <- new(World)
b$greet()
b$set("hello everybody")
b$greet()
rm(b)
invisible(NULL)
}
edd@max:/tmp$
Ok?
Dirk
--
Two new Rcpp master classes for R and C++ integration scheduled for
New York (Sep 24) and San Francisco (Oct 8), more details are at
http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10
http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel