[Rprotobuf-commits] r334 - pkg/inst/examples/HighFrequencyFinance

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jul 17 20:43:12 CEST 2010


Author: romain
Date: 2010-07-17 20:43:11 +0200 (Sat, 17 Jul 2010)
New Revision: 334

Modified:
   pkg/inst/examples/HighFrequencyFinance/loadInR.r
Log:
small update

Modified: pkg/inst/examples/HighFrequencyFinance/loadInR.r
===================================================================
--- pkg/inst/examples/HighFrequencyFinance/loadInR.r	2010-07-17 18:11:51 UTC (rev 333)
+++ pkg/inst/examples/HighFrequencyFinance/loadInR.r	2010-07-17 18:43:11 UTC (rev 334)
@@ -38,12 +38,11 @@
     x <- read( TradeData.Trades, "trades.pb")
     xl <- lapply( x$fill, as.list )
 
-    df <- data.frame(timestamp = sapply( xl, "[[", "timestamp" ),
+    df <- data.frame(timestamp = as.POSIXct( sapply( xl, "[[", "timestamp" ), origin="1970-01-01"),
                      symbol    = sapply( xl, "[[", "symbol" ),
                      price     = sapply( xl, "[[", "price" ),
                      size      = sapply( xl, "[[", "size" )
                      )
-    df[,1] <- as.POSIXct(df[,1], origin="1970-01-01")
     if (verbose) print(summary(df))
     invisible(df)
 }



More information about the Rprotobuf-commits mailing list