[R] interactive time series plot

From: Chris Paulse <cpaulse_at_aecom.yu.edu>
Date: Tue 30 Aug 2005 - 04:03:58 EST


Hi,

I've written the following function to display small windows of a time series (and a processed version of it) with mouse clicks used to move the window forward.  

ViewRawAndProcessed <- function(raw, processed, width=1000)

{

      len <- length(raw)

      n <- round(len/width)

      for (i in 1:n)

      {

            plot(raw[((i-1)*width):(i*width)], type="s")

            lines(processed[((i-1)*width):(i*width)], type="s", col="red")

            s <- sprintf("%d - %d", (i-1)*width,(i*width))

            mtext(s)

            par(ask=TRUE)

      }

}  

What I'd like to do is modify the function so that it stays within a loop and accepts right and left cursor keys (or h and l) to shift the current window backwards and forwards (with the q key causing a break from the loop).  

Is this possible with the par(ask=TRUE) command?  

Thanks,

Chris Paulse

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Aug 30 04:14:55 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:58 EST