Knut Ivar Nesheim wrote:

> Let's say I have a list of data, [10.5, 11.3, 10.2, None, 10.7] and  
> I'm using r.plot(data, type = "l"), None will be treated as 0.0  
> instead of just empty. Same thing if I use type = "o" or whatever.
> 
> I want the line just to stop where there's no data and then continue  
> again where I have some data. How would I do that?
> 

  In R, you do this with the 'NA' value. You can get this from rpy with 
rpy.NA:

  >>> from rpy import r
  >>> x=[1,2,3,4,5,6,7,8,9,10]
  >>> y=[5,4,3,4,5,6,r.NA,7,4,3]
  >>> r.plot(x,y)
  >>> r.lines(x,y)

rpy.NA seems to be a large negative integer, since I think Python 
doesn't support standard NA or NaN values. Perhaps the best thing to do 
is keep values as None and convert to rpy.NA at the last possible 
moment. Must be something in the docs...

Barry

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to