[R] Getting Rid of NaN in ts Object

Martin Maechler maechler at stat.math.ethz.ch
Sat May 28 18:47:52 CEST 2016


> Perfect!
> Exactly what I was looking for.
> Thanks

> Lorenzo

> On Fri, May 27, 2016 at 01:50:03PM +0200, Christian Brandstätter wrote:
>> Hi Lorenzo,
>> 
>> Try:
>> 
>> tt[is.nan(tt)] <- NA
>> tt <- na.omit(tt)
>> 

or simply  na.omit(tt)

as it omits both NA and NaN (and *does* keep the 'ts' properties
as you have noted).

Martin

>> Best,
>> 
>> Christian
>>



More information about the R-help mailing list