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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 24 20:21:24 CET 2013


Author: bodanker
Date: 2013-03-24 20:21:24 +0100 (Sun, 24 Mar 2013)
New Revision: 1411

Modified:
   pkg/quantstrat/R/indicators.R
Log:
- applyIndicators no longer overwrites colnames if they already exist


Modified: pkg/quantstrat/R/indicators.R
===================================================================
--- pkg/quantstrat/R/indicators.R	2013-03-19 13:10:23 UTC (rev 1410)
+++ pkg/quantstrat/R/indicators.R	2013-03-24 19:21:24 UTC (rev 1411)
@@ -192,15 +192,9 @@
         .formals$... <- NULL
         
         tmp_val<-do.call(fun,.formals)
-        if(is.null(colnames(tmp_val)) || !is.null(indicator$label)) {
-            if (ncol(tmp_val)==1) { #no names, only one column
-                colnames(tmp_val)<-indicator$label 
-            } else { #no names, more than one column
-                colnames(tmp_val) <- paste(indicator$label,seq(1,ncol(tmp_val)),sep='.') 
-            }  
-        } else { #we have column names, so paste
-            if(ncol(tmp_val)>1) colnames(tmp_val) <- paste(indicator$label,colnames(tmp_val),sep='.')
-        }
+        if(is.null(colnames(tmp_val)))
+            colnames(tmp_val) <- seq(ncol(tmp_val))
+        colnames(tmp_val) <- paste(indicator$label,colnames(tmp_val),sep='.')
 
         if (nrow(mktdata)==nrow(tmp_val) | length(mktdata)==length(tmp_val)) {
             # the indicator returned a time series, so we'll name it and cbind it



More information about the Blotter-commits mailing list