[Rinside-commits] r185 - in pkg: . inst/examples/standard

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 18 00:07:30 CET 2011


Author: edd
Date: 2011-02-18 00:07:29 +0100 (Fri, 18 Feb 2011)
New Revision: 185

Modified:
   pkg/ChangeLog
   pkg/inst/examples/standard/rinside_sample6.cpp
Log:
updated example


Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2011-01-27 02:13:06 UTC (rev 184)
+++ pkg/ChangeLog	2011-02-17 23:07:29 UTC (rev 185)
@@ -1,3 +1,8 @@
+2011-02-17  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/examples/standard/rinside_sample6.cpp: Updated to
+	direct `R["a"] = a;' assignments
+
 2011-01-26  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/examples/standard/rinside_sample10.cpp: New example in

Modified: pkg/inst/examples/standard/rinside_sample6.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample6.cpp	2011-01-27 02:13:06 UTC (rev 184)
+++ pkg/inst/examples/standard/rinside_sample6.cpp	2011-02-17 23:07:29 UTC (rev 185)
@@ -2,8 +2,8 @@
 //
 // Showing off some of the templated conversion due to Rcpp
 //
-// Copyright (C) 2009 Dirk Eddelbuettel 
-// Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2009        Dirk Eddelbuettel 
+// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
 
 #include <RInside.h>                    // for the embedded R via RInside
 
@@ -14,22 +14,22 @@
         RInside R(argc, argv);          // create an embedded R instance 
 
 	double d1 = 1.234;		// scalar double
-	R.assign(d1, "d1");
+	R["d1"] = d1;			// or R.assign(d1, "d1")
 
 	std::vector<double> d2;		// vector of doubles
 	d2.push_back(1.23);
 	d2.push_back(4.56);
-	R.assign(d2, "d2");
+	R["d2"] = d2;			// or R.assign(d2, "d2");
 
 	std::map< std::string, double > d3; // map of doubles
 	d3["a"] = 7.89;
 	d3["b"] = 7.07;
-	R.assign(d3, "d3");
+	R["d3"] = d3;			// or R.assign(d3, "d3");
 
 	std::list< double > d4; 	// list of doubles
 	d4.push_back(1.11);
 	d4.push_back(4.44);
-	R.assign(d4, "d4");
+	R["d4"] = d4;			// or R.assign(d4, "d4");
 
 	std::string txt = 		// now access in R
 	    "cat('\nd1=', d1, '\n'); print(class(d1));"



More information about the Rinside-commits mailing list