From: Knut I. N. <kn...@ur...> - 2008-03-09 21:17:30
|
Den 9. mars. 2008 kl. 19.52 skrev Barry Rowlingson: > 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... Great! Thanks! |