[R] Internal NA removal out of Time Series with na.omit.ts()
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Mar 8 09:24:42 CET 2004
On Mon, 8 Mar 2004, Adrian Trapletti wrote:
> > The na.omit.ts() method fails when the time series contains internal
> > NA's. How can these automatically be removed?
>
>
> try na.remove from tseries. This is, e.g., useful when removing weekends
> (NA prices) from financial data, i.e., switching from physical time to
> business time.
That may well not be appropriate though. NA denotes a missing and not a
non-existent value, and for example removing non-trading days in just one
market it probably not appropriate (as information accrues in other
markets).
The issue is not `How can the na.action be activated correctly?', but
`What is the appropriate na.action?', and the answer is usually `none of
them'.
> >>> spectrum(ts.mNDII, na.action=na.omit)
> >
> > Error in na.omit.ts(as.ts(x)) : time series contains internal NAs
> >
> > How can the na.action be activated correctly?
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list