[Rcpp-devel] RInside Abort

Dirk Eddelbuettel edd at debian.org
Fri Apr 22 06:35:05 CEST 2011


Chris,

Please use the rcpp-devel list for question. I am CCing the list now, please
follow up there. You need to subscribe to post.

Otherwise, nice post with all relevant details incl a Makefile, very nice.

On 22 April 2011 at 04:17, chris wrote:
| Hi Dirk,
| 
| Thanks for RInside. I hope this is appropriate, couldn't find anywhere else to
| try. My apologies in advance if it's a no-brainer.
| 
| I am trying to run multiple density plots (see attached) but failing with ...
| 
| Running rnorm()
| Plotting rv
| Error in .Call("R_isMethodsDispatchOn", onOff, PACKAGE = "base") : 
|   Incorrect number of arguments (2), expecting 1 for R_isMethodsDispatchOn
| terminate called after throwing an instance of 'Rcpp::binding_not_found'
|   what():  binding not found: '.AutoloadEnv'
| Aborted
| 
| Running ... 
| ubuntu 10.10

That is current, so use the Ubuntu repo at CRAN to get R 2.13.0, see

     http://cran.r-project.org/bin/linux/ubuntu/
 
| R version 2.11.1 (2010-05-31)
| Rcpp_0.9.4.tar.gz  

Rcpp 0.9.4 should require R (>= 2.12.0) for Reference Classes....

| RInside_0.2.2.tar.gz (just using supported packages so not able to go to 0.2.3)

With R 2.13.0 you'd get RInside 0.2.3 too.

| Makefile ...
| 
| INCDIRS=-I /usr/local/lib/R/site-library/RInside/lib -I /usr/lib/R/site-library
| /Rcpp/include -I /usr/share/R/include/
| LIBDIRS=-L /usr/local/lib/R/site-library/RInside/lib -L/usr/lib/R/lib -L /usr/
| lib/R/site-library/Rcpp/lib
| LIBDIRSPATH=/usr/local/lib/R/site-library/RInside/lib:/usr/lib/R/lib:/usr/lib/R
| /site-library/Rcpp/lib
| 
| 
| LIBS=-lRcpp -lRInside -lR
| 
| density: density.cpp
| g++ -o density density.cpp $(INCDIRS) $(LIBDIRS) $(LIBS) -Wl,-rpath,$
| (LIBDIRSPATH)
| 
| 
| 
| --
| chris boucher
| "In this house we obey the laws of thermodynamics!" - H. Simpson
| 
| ----------------------------------------------------------------------
| 
| #include <RInside.h>                    // for the embedded R via RInside
| 
| Rcpp::NumericVector createVector(const int n) {
|     Rcpp::NumericVector V(n);
|     for (int i=0; i<n; i++) {
|             V(i) = i*10;
|         }
|     return(V);
| }
| 
| void plot() {
|   const int N = 1000;
|   SEXP ans;
| 
|   RInside R;                      // create an embedded R instance

That is wrong. You can have only one RInside per program.  Start it in main()
and pass a reference into your plot(), that should work.

Dirk

| 
|   Rcpp::NumericVector V = createVector(N); 
|   R["V"] = V;                                 // assign C++ matrix M to R's 'M' var
|   R["N"] = N;
|   std::string evalstr = "\
|         cat('Running rnorm()\n'); rv <- rnorm(N);  \
|         x11(width=3,height=3);			  \
|         cat('Plotting rv\n'); plot(density(rv), main='rv', xlab='x');	  \
|         Sys.sleep(2);			          \
|         rv";                     
| 
|     ans = R.parseEval(evalstr);                 // eval the init string -- Z is now in ans
| 
| 
| }
| int main(int argc, char *argv[]) {
| 
|   plot();
|   plot();
|   exit(0);
| 
| 
| }
| 

-- 
Gauss checked the infinity of primes by counting them, starting from the last.
                                                  -- http://www.gaussfacts.com


More information about the Rcpp-devel mailing list