[R] plotting lines that break if data break

Denis Chabot chabotd at globetrotter.net
Wed Feb 8 03:29:20 CET 2006


Hi,

Sometimes data series (not necessarily time series) suffer breaks  
where data were expected, but not collected. Often the regular  
"lines" command to add such data to a plot is what I want, but other  
times I'd like the line to break where the data series is  
interrupted, instead of the line jumping to the next point in the  
series uninterrupted. Usually my data file contain one value of x but  
none of y, but alternatively a break could also appear as a NA value  
for both x and y.

I have found I could use the "segments" command instead of "lines",  
but this seems to require I manipulate my data (which may or may not  
contain breaks, and the number of breaks can vary if there are breaks  
at all).

Is there another command that works like "lines" but will break the  
line if the data series suffer an interruption?

Sincerely,

Denis Chabot




More information about the R-help mailing list