s-news
[Top] [All Lists]

Re: Displaying gaps in the data using plot.timeSeries()

To: Tony Plate <tplate@acm.org>
Subject: Re: Displaying gaps in the data using plot.timeSeries()
From: Isabella Ghement <isabella@stat.ubc.ca>
Date: Tue, 27 Mar 2007 14:32:30 -0700 (PDT)
Cc: S-news <s-news@lists.biostat.wustl.edu>
In-reply-to: <46097968.5070104@acm.org>
    Thank you so much to Stephen Veronneau and Tony Plate for their prompt
answers to my question!  Stephen pointed out that I would need to include
NA values in my timeSeries object to force plot() to recognize the
corresponding gaps in the data, and Tony explained how to achieve that
using the align() function.  Problem solved!  

    Cheers, 

    Isabella  


On Tue, 27 Mar 2007, Tony Plate wrote:

> Try something along these lines:
> 
>  > B <- timeSeries(cbind(B1=4:7,B2=7:10),pos=timeDate(julian=c(1:2,5:6)))
>  > align(B, pos=timeDate(julian=1:6))
>    Positions B1 B2
>   1960/01/02  4  7
>   1960/01/03  5  8
>   1960/01/04 NA NA
>   1960/01/05 NA NA
>   1960/01/06  6  9
>   1960/01/07  7 10
>  > plot(align(B, pos=timeDate(julian=1:6)), reference.grid=F)
> 
> You might also want to explore the x.axis.args argument to 
> plot.timeSeries, e.g.:
>  > plot(align(B, pos=timeDate(julian=1:6)), reference.grid=F, 
> x.axis.args=list(nobreaks=T, skip.weekends=F))
>  >
> 
> (Though it makes no difference in this case.)
> 
> -- Tony Plate
> 
> Isabella Ghement wrote:
> > Hello, 
> > 
> > I have a timeSeries object B containing data for non-consecutive days,
> > say: 
> > 
> > B <- timeSeries(cbind(B1=4:7,B2=7:10),pos=c(1:2,5:6))
> > 
> > and  would like to plot it such that the gaps in the data are visible.
> > However, when I use the plot.timeSeries() function,  the data points
> > corresponding to non-consecutive days are connected through a line:
> > 
> > plot.timeSeries(B,reference.grid=F)
> > 
> > Is there a way to get plot.timeSeries to automatically recognize the gaps
> > in the data and display them as such?   
> > 
> > Thank you in advance for any insight you may be able to provide! 
> > 
> > Isabella R. Ghement, Ph.D.
> > 
> > 
> > 
> > 
> > 
> > 
> > --------------------------------------------------------------------
> > This message was distributed by s-news@lists.biostat.wustl.edu.  To
> > unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> > the BODY of the message:  unsubscribe s-news
> > 
> 
> 


<Prev in Thread] Current Thread [Next in Thread>
  • Re: Displaying gaps in the data using plot.timeSeries(), Isabella Ghement <=