[Xts-commits] r670 - in pkg/xtsExtra: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 3 22:30:14 CEST 2012


Author: weylandt
Date: 2012-07-03 22:30:14 +0200 (Tue, 03 Jul 2012)
New Revision: 670

Modified:
   pkg/xtsExtra/R/plot.R
   pkg/xtsExtra/man/plot.xts.Rd
Log:
Use POSIXct internally for abline

Modified: pkg/xtsExtra/R/plot.R
===================================================================
--- pkg/xtsExtra/R/plot.R	2012-07-03 03:07:47 UTC (rev 669)
+++ pkg/xtsExtra/R/plot.R	2012-07-03 20:30:14 UTC (rev 670)
@@ -293,17 +293,17 @@
   ylim <- xy$y
   
   if(!missing(blocks)){
-    for(j in seq_along(blocks)){
-      do_add.shading(start.time = do.call(paste0("as.",indexClass(x))[1], list(get.elm.recycle(blocks[["start.time"]], j))),
-                     end.time   = do.call(paste0("as.",indexClass(x))[1], list(get.elm.recycle(blocks[["end.time"]], j))),
+    for(j in seq_along(blocks[["time"]])){
+      do_add.shading(start.time = as.POSIXct(get.elm.recycle(blocks[["start.time"]], j)),
+                     end.time   = as.POSIXct(get.elm.recycle(blocks[["end.time"]], j)),
                      col = if(!is.null(blocks[["col"]])) get.elm.recycle(blocks[["col"]],j) else "lightblue1", 
                      y = range(ylim))
     }
   }
   
   if(!missing(events)){
-    for(j in seq_along(events)){
-      do_add.event(time = do.call(paste0("as.",indexClass(x))[1], list(get.elm.recycle(events[["time"]], j))),
+    for(j in seq_along(events[["time"]])){
+      do_add.event(time = as.POSIXct(get.elm.recycle(events[["time"]],j)),
                    label = get.elm.recycle(events[["label"]], j),
                    col = if(!is.null(events[["col"]])) get.elm.recycle(events[["col"]],j) else "red", 
                    lty = if(!is.null(events[["lty"]])) get.elm.recycle(events[["lty"]],j) else 2,
@@ -421,4 +421,4 @@
      length.out = length(screens)), screens), n)
 }
 
-QUANTMOD_MESSAGE <- TRUE # Suggests quantmod to user of OHLC plot.xts
\ No newline at end of file
+QUANTMOD_MESSAGE <- TRUE # Suggests quantmod to user of OHLC plot.xts

Modified: pkg/xtsExtra/man/plot.xts.Rd
===================================================================
--- pkg/xtsExtra/man/plot.xts.Rd	2012-07-03 03:07:47 UTC (rev 669)
+++ pkg/xtsExtra/man/plot.xts.Rd	2012-07-03 20:30:14 UTC (rev 670)
@@ -113,7 +113,7 @@
 plot(merge(x,x), type = "p", col = list(1:5, 1:3), pch = list(1:5, 1:3), cex = list(1:5, 1:3))
 
 # Using the events argument
-plot(x[,1], events = list(time = c("2007-03-15", "2007-05-01"), label = "bad day"))
+plot(sample_xts[,1], events = list(time = c("2007-03-15", "2007-05-01"), label = "bad day"))
 
 # Makes a scatterplot if we pass two series
 plot(sample_xts[,1],sample_xts[,2])



More information about the Xts-commits mailing list