[R] Handling of irregular time series in lineChart

From: Robert A'gata <rhelpacc_at_gmail.com>
Date: Thu, 28 Apr 2011 20:02:11 -0400


Hi,

I realized that when I have irregular series to feed into lineChart, the interval of each point in the chart does not seem to take care of irregular time interval I specified in my input xts time series. But rather, lineChart seems to take each point as equal spaced time series. For example, I have the following code:

library(quantmod)
options(digits.sec=3)

t0 <- as.POSIXct("2010-04-20 09:30:00.000");

tvec1 <- runif(1000,0,1000);
tvec1 <- sort(tvec1);
tvec1 <- t0+tvec1;

t0 <- as.POSIXct("2010-04-20 12:30:00.000");

tvec2 <- runif(1000,0,1000);
tvec2 <- sort(tvec2);
tvec2 <- t0+tvec2;

tvec <- c(tvec1,tvec2);
data <- cumsum(rnorm(length(tvec)));

tseries <- xts(data,tvec);

lineChart(tseries);

There are two clusters of data points around 9:30AM and 12:30PM. However, when lineChart displays result, it is quite clear that all points are set to be equally spaced in time. I'm wondering if I miss-specified any parameters or not. Any advice would be much appreciated. Thank you in advance.

Robert



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 29 Apr 2011 - 00:06:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 29 Apr 2011 - 04:30:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive