[Blotter-commits] r817 - pkg/FinancialInstrument/sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 10 23:20:47 CEST 2011


Author: gsee
Date: 2011-10-10 23:20:46 +0200 (Mon, 10 Oct 2011)
New Revision: 817

Modified:
   pkg/FinancialInstrument/sandbox/download.tblox.R
Log:
 make month_cycle extraction more R-like

Modified: pkg/FinancialInstrument/sandbox/download.tblox.R
===================================================================
--- pkg/FinancialInstrument/sandbox/download.tblox.R	2011-10-10 15:22:43 UTC (rev 816)
+++ pkg/FinancialInstrument/sandbox/download.tblox.R	2011-10-10 21:20:46 UTC (rev 817)
@@ -96,12 +96,7 @@
             denom <- as.numeric(gsub("h","",strsplit(tick,"/")[[1]][2]))
             tick <- numer / denom
         }
-        tmonths <- NULL
-        for (j in 1:nchar(def[i,6])) tmonths <- c(tmonths, substr(def[i,6],j,j))
-        tmonths <- paste(tmonths,collapse=",")
-        #FIXME: How do I turn "FGHJKMNQUVXZ"
-        # into "F,G,H,J,K,M,N,Q,U,V,X,Z"
-        # without using a for loop?
+        tmonths <- paste(strsplit(def[i,6],"")[[1]], collapse=",")
         primary_id <- paste(def[i,1])
         instr <- try(getInstrument(primary_id,silent=TRUE),silent=TRUE)
         if (inherits(instr,'try-error') || !is.instrument(instr)) {



More information about the Blotter-commits mailing list