[R] Connecting points over missing observations in Lattice

David Winsemius dwinsemius at comcast.net
Sat Oct 8 20:11:10 CEST 2011


On Oct 8, 2011, at 4:59 AM, Allan Sikk wrote:

> Hello,
>
> I'm trying to plot connected time series of two variables in a  
> lattice plot:
> xyplot(y1 + y2 ~ t,  data=size, type="b")
>
> y2 has missing data for some of the observations and some points are
> therefore not connected. It would make theoretical sense to connect  
> the
> points - is there a way of doing that? (Without filling the  
> obserations
> using package 'zoo').

Can't you just use:

   xyplot(y1 + y2 ~ t, data=size,  subset = !is.na(y2) )


> Thanks,
> Allan

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list