[Rinside-commits] r172 - pkg/inst/examples/standard

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 9 16:11:15 CEST 2010


Author: edd
Date: 2010-07-09 16:11:15 +0200 (Fri, 09 Jul 2010)
New Revision: 172

Modified:
   pkg/inst/examples/standard/rinside_sample4.cpp
Log:
repair sample4


Modified: pkg/inst/examples/standard/rinside_sample4.cpp
===================================================================
--- pkg/inst/examples/standard/rinside_sample4.cpp	2010-07-05 17:23:02 UTC (rev 171)
+++ pkg/inst/examples/standard/rinside_sample4.cpp	2010-07-09 14:11:15 UTC (rev 172)
@@ -14,7 +14,7 @@
         RInside R(argc, argv);          // create an embedded R instance 
 
 	std::string txt = 
-	    "suppressMessages(library(fPortfolio))"
+	    "suppressMessages(library(fPortfolio)); "
 	    "lppData <- 100 * LPP2005.RET[, 1:6]; "
             "ewSpec <- portfolioSpec(); " 
             "nAssets <- ncol(lppData); ";
@@ -29,10 +29,11 @@
         txt = 
 	    "ewPf <- feasiblePortfolio(data=lppData, spec=ewSpec, constraints=\"LongOnly\");"
             "print(ewPf); "
-            "vec <- getCovRiskBudgets(ewPortfolio at portfolio)";
+            "vec <- getCovRiskBudgets(ewPf at portfolio)";
         Rcpp::NumericVector   V(     (SEXP) R.parseEval(txt) ); 
         Rcpp::CharacterVector names( (SEXP) R.parseEval("names(vec)"));   
 
+	std::cout << "\n\nAnd now from C++\n\n";
         for (int i=0; i<names.size(); i++) {
           std::cout << std::setw(16) << names[i] << "\t"
                     << std::setw(11) << V[i] << "\n";



More information about the Rinside-commits mailing list