[Rinside-commits] r133 - in pkg/inst/examples: mpi standard

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 21 21:05:13 CET 2010


Author: edd
Date: 2010-03-21 21:05:10 +0100 (Sun, 21 Mar 2010)
New Revision: 133

Modified:
   pkg/inst/examples/mpi/rinside_mpi_sample0.cpp
   pkg/inst/examples/mpi/rinside_mpi_sample1.cpp
   pkg/inst/examples/mpi/rinside_mpi_sample2.cpp
   pkg/inst/examples/mpi/rinside_mpi_sample3.cpp
   pkg/inst/examples/standard/rinside_sample0.cpp
   pkg/inst/examples/standard/rinside_sample1.cpp
   pkg/inst/examples/standard/rinside_sample2.cpp
   pkg/inst/examples/standard/rinside_sample3.cpp
   pkg/inst/examples/standard/rinside_sample4.cpp
   pkg/inst/examples/standard/rinside_sample5.cpp
   pkg/inst/examples/standard/rinside_sample6.cpp
   pkg/inst/examples/standard/rinside_sample7.cpp
   pkg/inst/examples/standard/rinside_sample8.cpp
   pkg/inst/examples/standard/rinside_test0.cpp
   pkg/inst/examples/standard/rinside_test1.cpp
Log:
 o switch to include <RInside.h> (ie not the double-quoted variant)
 o simplify sample0 even more
 o untabify all files so that the code looks structured nowhatter what editor
   is used


Modified: pkg/inst/examples/mpi/rinside_mpi_sample0.cpp
===================================================================
--- pkg/inst/examples/mpi/rinside_mpi_sample0.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/mpi/rinside_mpi_sample0.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -4,9 +4,8 @@
 //
 // This file was contributed by Jianping Hua 
 
-#include "mpi.h"     // mpi header
-#include "RInside.h" // for the embedded R via RInside
-#include "Rcpp.h"    // for the R / Cpp interface used for transfer
+#include <mpi.h>     // mpi header
+#include <RInside.h> // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 
@@ -16,17 +15,17 @@
     MPI_Comm_rank(MPI_COMM_WORLD, &myrank);     // obtain current node rank
     MPI_Comm_size(MPI_COMM_WORLD, &nodesize);   // obtain total nodes running.
 
-    RInside R(argc, argv);              	// create an embedded R instance
+    RInside R(argc, argv);                      // create an embedded R instance
 
     std::stringstream txt;
-    txt << "Hello from node " << myrank       	// node information
+    txt << "Hello from node " << myrank         // node information
         << " of " << nodesize << " nodes!" << std::endl;
-    R.assign( txt.str(), "txt");              	// assign string var to R variable 'txt'
+    R.assign( txt.str(), "txt");                // assign string var to R variable 'txt'
 
-    std::string evalstr = "cat(txt)"; 		// show node information
-    R.parseEvalQ(evalstr);            		// eval the init string, ignoring any returns
+    std::string evalstr = "cat(txt)";           // show node information
+    R.parseEvalQ(evalstr);                      // eval the init string, ignoring any returns
 
-    MPI_Finalize();  		  		// mpi finalization
+    MPI_Finalize();                             // mpi finalization
 
     exit(0);
 }

Modified: pkg/inst/examples/mpi/rinside_mpi_sample1.cpp
===================================================================
--- pkg/inst/examples/mpi/rinside_mpi_sample1.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/mpi/rinside_mpi_sample1.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -4,9 +4,8 @@
 //
 // This file was contributed by Jianping Hua 
 
-#include "mpi.h"     // mpi header file
-#include "RInside.h" // for the embedded R via RInside
-#include "Rcpp.h"    // for the R / Cpp interface used for transfer
+#include <mpi.h>     // mpi header file
+#include <RInside.h> // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 
@@ -17,7 +16,7 @@
     MPI_Comm_rank(MPI_COMM_WORLD, &myrank);     // obtain current node rank
     MPI_Comm_size(MPI_COMM_WORLD, &nodesize);   // obtain total nodes running.
     double sendValue;                           // value to be collected in current node
-    double *allvalues = new double[nodesize]; 	// to save all results
+    double *allvalues = new double[nodesize];   // to save all results
 
     // simulation info
     // to sample from a uniform distribution
@@ -39,8 +38,8 @@
         R.parseEvalQ( txt.str() );      // assign n with the size of sample
 
         std::string evalstr = " mean(runif(n,x,y))";  // sampling, compute the mean
-        ans = R.parseEval(evalstr);	// eval the evalstr string, return results
-	Rcpp::NumericVector m(ans);     // convert SEXP variable to an Rcpp::NumericVector
+        ans = R.parseEval(evalstr);     // eval the evalstr string, return results
+        Rcpp::NumericVector m(ans);     // convert SEXP variable to an Rcpp::NumericVector
 
         sendValue = m( 0 );             // assign the return value to the variable to be gathered
 
@@ -58,10 +57,10 @@
 
     // show gathered results in node 0
     if ( myrank == 0 ) {
-	std::cout << "values of all " << nodesize << " trials: " << std::endl;
-	for ( int i = 0; i < nodesize; i++ )
-	    std::cout << allvalues[ i ] << ", ";
-	std::cout << std::endl;
+        std::cout << "values of all " << nodesize << " trials: " << std::endl;
+        for ( int i = 0; i < nodesize; i++ )
+            std::cout << allvalues[ i ] << ", ";
+        std::cout << std::endl;
     }
 
     // clean up

Modified: pkg/inst/examples/mpi/rinside_mpi_sample2.cpp
===================================================================
--- pkg/inst/examples/mpi/rinside_mpi_sample2.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/mpi/rinside_mpi_sample2.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -4,9 +4,8 @@
 //
 // MPI C++ API version of file contributed by Jianping Hua 
 
-#include "mpi.h"     // mpi header
-#include "RInside.h" // for the embedded R via RInside
-#include "Rcpp.h"    // for the R / Cpp interface used for transfer
+#include <mpi.h>     // mpi header
+#include <RInside.h> // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 
@@ -14,17 +13,17 @@
     int myrank = MPI::COMM_WORLD.Get_rank();    // obtain current node rank
     int nodesize = MPI::COMM_WORLD.Get_size();  // obtain total nodes running.
 
-    RInside R(argc, argv);              	// create an embedded R instance
+    RInside R(argc, argv);                      // create an embedded R instance
 
     std::stringstream txt;
-    txt << "Hello from node " << myrank       	// node information
+    txt << "Hello from node " << myrank         // node information
         << " of " << nodesize << " nodes!" << std::endl;
-    R.assign( txt.str(), "txt");              	// assign string var to R variable 'txt'
+    R.assign( txt.str(), "txt");                // assign string var to R variable 'txt'
 
-    std::string evalstr = "cat(txt)"; 		// show node information
-    R.parseEvalQ(evalstr);            		// eval the init string, ignoring any returns
+    std::string evalstr = "cat(txt)";           // show node information
+    R.parseEvalQ(evalstr);                      // eval the init string, ignoring any returns
 
-    MPI::Finalize();  		  		// mpi finalization
+    MPI::Finalize();                            // mpi finalization
 
     exit(0);
 }

Modified: pkg/inst/examples/mpi/rinside_mpi_sample3.cpp
===================================================================
--- pkg/inst/examples/mpi/rinside_mpi_sample3.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/mpi/rinside_mpi_sample3.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -4,9 +4,8 @@
 //
 // MPI C++ API version of file contributed by Jianping Hua 
 
-#include "mpi.h"     // mpi header file
-#include "RInside.h" // for the embedded R via RInside
-#include "Rcpp.h"    // for the R / Cpp interface used for transfer
+#include <mpi.h>     // mpi header file
+#include <RInside.h> // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 
@@ -16,7 +15,7 @@
 
     int sndcnt = 1, rcvcnt = 1;                 // # of elements in send/recv buffer
     double sendValue;                           // value to be collected in current node
-    double *allvalues = new double[nodesize]; 	// to save all results
+    double *allvalues = new double[nodesize];   // to save all results
 
     // simulation info
     // to sample from a uniform distribution
@@ -38,13 +37,13 @@
         R.parseEvalQ( txt.str() );      // assign n with the size of sample
 
         std::string evalstr = " mean(runif(n,x,y))";  // sampling, compute the mean
-        ans = R.parseEval(evalstr);	// eval the evalstr string, return results
-	Rcpp::NumericVector m(ans);     // convert SEXP variable to an Rcpp::NumericVector
+        ans = R.parseEval(evalstr);     // eval the evalstr string, return results
+        Rcpp::NumericVector m(ans);     // convert SEXP variable to an Rcpp::NumericVector
 
         sendValue = m( 0 );             // assign the return value to the variable to be gathered
 
         //gather together values from all processes to allvalues
-	MPI::COMM_WORLD.Gather((const void*)&sendValue, sndcnt, MPI::DOUBLE, (void*)allvalues, rcvcnt, MPI::DOUBLE, 0);
+        MPI::COMM_WORLD.Gather((const void*)&sendValue, sndcnt, MPI::DOUBLE, (void*)allvalues, rcvcnt, MPI::DOUBLE, 0);
 
         // show what inidividual node's contribution
         std::cout << "node " << myrank << " has mean " << m(0) << std::endl;
@@ -57,10 +56,10 @@
 
     // show gathered results in node 0
     if ( myrank == 0 ) {
-	std::cout << "values of all " << nodesize << " trials: " << std::endl;
-	for ( int i = 0; i < nodesize; i++ )
-	    std::cout << allvalues[ i ] << ", ";
-	std::cout << std::endl;
+        std::cout << "values of all " << nodesize << " trials: " << std::endl;
+        for ( int i = 0; i < nodesize; i++ )
+            std::cout << allvalues[ i ] << ", ";
+        std::cout << std::endl;
     }
 
     // clean up

Modified: pkg/inst/examples/standard/rinside_sample0.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample0.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_sample0.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -1,24 +1,22 @@
 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4;  tab-width: 8; -*-
 //
-// Simple example showing an overly complicated way to do the standard 'hello, world' example
+// Simple example showing how to do the standard 'hello, world' using embedded R
 //
 // Copyright (C) 2009 Dirk Eddelbuettel 
 // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
 //
 // GPL'ed 
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 
     RInside R(argc, argv);              // create an embedded R instance 
-    
-    std::string txt = "Hello, world!\n";// assign a standard C++ string to 'txt'
-    R["txt"] = txt;			// assign C++ string var to R variable 'txt'
 
-    std::string evalstr = "cat(txt)";
-    R.parseEvalQ(evalstr);              // eval the init string, ignoring any returns
+    R["txt"] = "Hello, world!\n";	// assign a char* (string) to 'txt'
 
+    R.parseEvalQ("cat(txt)");           // eval the init string, ignoring any returns
+
     exit(0);
 }
 

Modified: pkg/inst/examples/standard/rinside_sample1.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample1.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_sample1.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -7,7 +7,7 @@
 //
 // GPL'ed 
 
-#include "RInside.h"            // for the embedded R via RInside
+#include <RInside.h>                            // for the embedded R via RInside
 
 Rcpp::NumericMatrix createMatrix(const int n) {
     Rcpp::NumericMatrix M(n,n);
@@ -20,24 +20,24 @@
 }
 
 int main(int argc, char *argv[]) {
-    const int mdim = 4;
+    const int mdim = 4;                         // let the matrices be 4 by 4 
     SEXP ans;
 
-    RInside R(argc, argv); 		        // create an embedded R instance 
+    RInside R(argc, argv);                      // create an embedded R instance 
     
-    Rcpp::NumericMatrix M = createMatrix(mdim);	// create and fill a sample data Matrix 
-    R["M"] = M;   	   		        // assign C++ matrix M to R's 'M' var
+    Rcpp::NumericMatrix M = createMatrix(mdim); // create and fill a sample data Matrix 
+    R["M"] = M;                                 // assign C++ matrix M to R's 'M' var
 
     std::string evalstr = "\
-        cat('Running ls()\n'); print(ls()); 		       \
-        cat('Showing M\n'); print(M);			       \
+        cat('Running ls()\n'); print(ls());                    \
+        cat('Showing M\n'); print(M);                          \
         cat('Showing colSums()\n'); Z <- colSums(M); print(Z); \
         Z";                     // returns Z
 
-    ans = R.parseEval(evalstr);    		// eval the init string -- Z is now in ans
-    						
-    Rcpp::NumericVector v(ans);			// convert SEXP ans to a vector of doubles
-    for (int i=0; i< v.size(); i++) {		// show the result
+    ans = R.parseEval(evalstr);                 // eval the init string -- Z is now in ans
+                                                
+    Rcpp::NumericVector v(ans);                 // convert SEXP ans to a vector of doubles
+    for (int i=0; i< v.size(); i++) {           // show the result
         std::cout << "In C++ element " << i << " is " << v[i] << std::endl;
     }
     exit(0);

Modified: pkg/inst/examples/standard/rinside_sample2.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample2.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_sample2.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -5,7 +5,7 @@
 // Copyright (C) 2009 Dirk Eddelbuettel 
 // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 
@@ -14,21 +14,21 @@
         SEXP ans;
 
         std::string txt = "suppressMessages(library(fPortfolio))";
-        R.parseEvalQ(txt);	        // load library, no return value
+        R.parseEvalQ(txt);              // load library, no return value
 
         txt = "M <- as.matrix(SWX.RET); print(head(M)); M";
-        ans = R.parseEval(txt);	      	// assign matrix M to SEXP variable ans
+        ans = R.parseEval(txt);         // assign matrix M to SEXP variable ans
 
-	Rcpp::NumericMatrix M(ans);     // convert SEXP variable to a NumericMatrix
+        Rcpp::NumericMatrix M(ans);     // convert SEXP variable to a NumericMatrix
 
         std::cout << "M has " 
                   << M.nrow() << " rows and " 
                   << M.ncol() << " cols" << std::endl;
         
         txt = "colnames(M)";
-        ans = R.parseEval(txt); 	// assign columns names of M to ans
+        ans = R.parseEval(txt);         // assign columns names of M to ans
 
-	Rcpp::CharacterVector cnames(ans);   // and into string vector cnames
+        Rcpp::CharacterVector cnames(ans);   // and into string vector cnames
 
         for (int i=0; i<M.ncol(); i++) {
             std::cout << "Column " << cnames[i] << " in row 42 has " << M(42,i) << std::endl;

Modified: pkg/inst/examples/standard/rinside_sample3.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample3.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_sample3.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -5,7 +5,7 @@
 // Copyright (C) 2009 Dirk Eddelbuettel 
 // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 #include <iomanip>
 
 int main(int argc, char *argv[]) {

Modified: pkg/inst/examples/standard/rinside_sample4.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample4.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_sample4.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -5,7 +5,7 @@
 // Copyright (C) 2009 Dirk Eddelbuettel 
 // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 #include <iomanip>
 
 int main(int argc, char *argv[]) {
@@ -15,34 +15,34 @@
         SEXP ans;
 
         std::string txt = "suppressMessages(library(fPortfolio))";
-        R.parseEvalQ(txt);	        // load library, no return value
+        R.parseEvalQ(txt);              // load library, no return value
 
         txt = "lppData <- 100 * LPP2005.RET[, 1:6]; "
-	    "ewSpec <- portfolioSpec(); " 
-	    "nAssets <- ncol(lppData); ";
-        R.parseEval(txt, ans);		// prepare problem
-	
-	const double dvec[6] = { 0.1, 0.1, 0.1, 0.1, 0.3, 0.3 }; // choose any weights you want
-	const std::vector<double> w(dvec, &dvec[6]);
+            "ewSpec <- portfolioSpec(); " 
+            "nAssets <- ncol(lppData); ";
+        R.parseEval(txt, ans);          // prepare problem
+        
+        const double dvec[6] = { 0.1, 0.1, 0.1, 0.1, 0.3, 0.3 }; // choose any weights you want
+        const std::vector<double> w(dvec, &dvec[6]);
 
-	R.assign( w, "weightsvec");	// assign STL vector to R's 'weightsvec' variable
+        R.assign( w, "weightsvec");     // assign STL vector to R's 'weightsvec' variable
 
-	txt = "setWeights(ewSpec) <- weightsvec";
-        R.parseEvalQ(txt);		// evaluate assignment
+        txt = "setWeights(ewSpec) <- weightsvec";
+        R.parseEvalQ(txt);              // evaluate assignment
 
-	txt = "ewPortfolio <- feasiblePortfolio(data = lppData, spec = ewSpec, "
-	    "                                   constraints = \"LongOnly\"); "
-	    "print(ewPortfolio); "
-	    "vec <- getCovRiskBudgets(ewPortfolio at portfolio)";
-        ans = R.parseEval(txt);  	// assign covRiskBudget weights to ans
-	Rcpp::NumericVector V(ans);  	// convert SEXP variable to an RcppVector
+        txt = "ewPortfolio <- feasiblePortfolio(data = lppData, spec = ewSpec, "
+            "                                   constraints = \"LongOnly\"); "
+            "print(ewPortfolio); "
+            "vec <- getCovRiskBudgets(ewPortfolio at portfolio)";
+        ans = R.parseEval(txt);         // assign covRiskBudget weights to ans
+        Rcpp::NumericVector V(ans);     // convert SEXP variable to an RcppVector
   
-	ans = R.parseEval("names(vec)");	// assign columns names to ans
-	Rcpp::CharacterVector names(ans);   
+        ans = R.parseEval("names(vec)");        // assign columns names to ans
+        Rcpp::CharacterVector names(ans);   
 
-	for (int i=0; i<names.size(); i++) {
-	  std::cout << std::setw(16) << names[i] << "\t"
-		    << std::setw(11) << V[i] << "\n";
+        for (int i=0; i<names.size(); i++) {
+          std::cout << std::setw(16) << names[i] << "\t"
+                    << std::setw(11) << V[i] << "\n";
         }
         
     } catch(std::exception& ex) {

Modified: pkg/inst/examples/standard/rinside_sample5.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample5.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_sample5.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -5,7 +5,7 @@
 // Copyright (C) 2009 Dirk Eddelbuettel 
 // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 
@@ -14,15 +14,15 @@
         SEXP ans;
 
         std::string txt = "myenv <- new.env(hash=TRUE, size=NA)";
-        R.parseEvalQ(txt);          	// eval string quietly, no result
+        R.parseEvalQ(txt);              // eval string quietly, no result
 
         txt = "as.integer(is.environment(myenv))";
-        ans = R.parseEval(txt);      	// eval string, result in ans
-	Rcpp::LogicalVector V(ans);   	// convert SEXP variable to vector
+        ans = R.parseEval(txt);         // eval string, result in ans
+        Rcpp::LogicalVector V(ans);     // convert SEXP variable to vector
 
-	std::cout << "We "
-		  << (V(0) ? "do" : "do not")
-		  << " have an environment." << std::endl;
+        std::cout << "We "
+                  << (V(0) ? "do" : "do not")
+                  << " have an environment." << std::endl;
         
     } catch(std::exception& ex) {
         std::cerr << "Exception caught: " << ex.what() << std::endl;

Modified: pkg/inst/examples/standard/rinside_sample6.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample6.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_sample6.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -5,7 +5,7 @@
 // Copyright (C) 2009 Dirk Eddelbuettel 
 // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 

Modified: pkg/inst/examples/standard/rinside_sample7.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample7.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_sample7.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -4,25 +4,25 @@
 //
 // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 
     try {
 
         RInside R(argc, argv);          // create an embedded R instance 
-	SEXP ans;
-	std::string txt;
+        SEXP ans;
+        std::string txt;
 
-	txt = "m <- 1.23";
+        txt = "m <- 1.23";
         R.parseEval(txt, ans);
-	double d1 = Rcpp::as< double >(ans);
-	std::cout << "d1 " << d1 << std::endl;
+        double d1 = Rcpp::as< double >(ans);
+        std::cout << "d1 " << d1 << std::endl;
 
-	txt = "M <- 1.0 * 1:6";
+        txt = "M <- 1.0 * 1:6";
         R.parseEval(txt, ans);
-	std::vector<double> d2 = Rcpp::as< std::vector< double > >(ans);
-	std::cout << "d2[0] " << d2[0] << " d2[1] " << d2[1] << std::endl;
+        std::vector<double> d2 = Rcpp::as< std::vector< double > >(ans);
+        std::cout << "d2[0] " << d2[0] << " d2[1] " << d2[1] << std::endl;
         
     } catch(std::exception& ex) {
         std::cerr << "Exception caught: " << ex.what() << std::endl;

Modified: pkg/inst/examples/standard/rinside_sample8.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample8.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_sample8.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -4,17 +4,17 @@
 //
 // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois and GPL'ed 
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 
     RInside R(argc, argv);              // create an embedded R instance 
     
-    R["x"] = 10 ;			// assignment can be done directly via []
+    R["x"] = 10 ;                       // assignment can be done directly via []
     R["y"] = 20 ;
 
-    R.parseEvalQ("z <- x + y") ;	// R statement evaluation and result 
-    int sum = Rcpp::as<int>( R["z"] ); 	// retrieval via access using [] and as() wrapper
+    R.parseEvalQ("z <- x + y") ;        // R statement evaluation and result 
+    int sum = Rcpp::as<int>( R["z"] );  // retrieval via access using [] and as() wrapper
     std::cout << "10 + 20 = " << sum << std::endl ; 
 
     // we can also return the value directly

Modified: pkg/inst/examples/standard/rinside_test0.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_test0.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_test0.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -4,7 +4,7 @@
 //
 // Copyright (C) 2009 Dirk Eddelbuettel and GPL'ed 
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 

Modified: pkg/inst/examples/standard/rinside_test1.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_test1.cpp	2010-03-20 21:43:02 UTC (rev 132)
+++ pkg/inst/examples/standard/rinside_test1.cpp	2010-03-21 20:05:10 UTC (rev 133)
@@ -4,7 +4,7 @@
 //
 // Copyright (C) 2009 Dirk Eddelbuettel and GPL'ed 
 
-#include "RInside.h"                    // for the embedded R via RInside
+#include <RInside.h>                    // for the embedded R via RInside
 
 int main(int argc, char *argv[]) {
 



More information about the Rinside-commits mailing list