[Blotter-commits] r1114 - pkg/quantstrat/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 1 16:25:11 CEST 2012


Author: opentrades
Date: 2012-08-01 16:25:11 +0200 (Wed, 01 Aug 2012)
New Revision: 1114

Modified:
   pkg/quantstrat/R/tradeGraphs.R
Log:
vectorized inner for loop in tradeGraphs.R

Modified: pkg/quantstrat/R/tradeGraphs.R
===================================================================
--- pkg/quantstrat/R/tradeGraphs.R	2012-07-31 22:56:52 UTC (rev 1113)
+++ pkg/quantstrat/R/tradeGraphs.R	2012-08-01 14:25:11 UTC (rev 1114)
@@ -54,14 +54,10 @@
 
                 graph.data <- matrix(NA, nrows, ncols)
 
-                for(i in 1:nrow(stats[free.params[1]]))
-                {
-                        free.param.1 = stats[[free.params[1]]][i]
-                        free.param.2 = stats[[free.params[2]]][i]
+                graph.data[cbind(
+				stats[[free.params[1]]] - min.free.param.1 + 1,
+				stats[[free.params[2]]] - min.free.param.2 + 1)] <- stats[[statistic]]
 
-                        graph.data[free.param.1 - min.free.param.1 + 1, free.param.2 - min.free.param.2 + 1] = stats[[statistic]][i]
-                }
-
                 # set up color vector
 
                 range.statistic = range(stats[[statistic]])



More information about the Blotter-commits mailing list