You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
20 na.approx<br />
Usage<br />
na.approx(object, ...)<br />
## S3 method for class ’zoo’<br />
na.approx(object, x = index(object), xout, ..., na.rm = TRUE, along)<br />
## S3 method for class ’zooreg’<br />
na.approx(object, ...)<br />
## S3 method for class ’ts’<br />
na.approx(object, ...)<br />
## Default S3 method:<br />
na.approx(object, x = index(object), xout, ..., na.rm = TRUE, maxgap = Inf, along)<br />
na.spline(object, ...)<br />
## S3 method for class ’zoo’<br />
na.spline(object, x = index(object), xout, ..., na.rm = TRUE, along)<br />
## S3 method for class ’zooreg’<br />
na.spline(object, ...)<br />
## S3 method for class ’ts’<br />
na.spline(object, ...)<br />
## Default S3 method:<br />
na.spline(object, x = index(object), xout, ..., na.rm = TRUE, maxgap = Inf, along)<br />
Arguments<br />
Details<br />
object object in which NAs are to be replaced<br />
x, xout Variables to be used for interpolation as in approx.<br />
na.rm logical. Should leading NAs be removed?<br />
maxgap maximum number of consecutive NAs to fill. Any longer gaps will be left unchanged.<br />
Note that all methods listed above can accept maxgap as it is ultimately<br />
passed to the default method.<br />
along deprecated.<br />
... further arguments passed to methods. The n argument of approx is currently<br />
not supported.<br />
Missing values (NAs) are replaced by linear interpolation via approx or cubic spline interpolation<br />
via spline, respectively.<br />
It can also be used for series disaggregation by specifying xout.<br />
By default the index associated with object is used for interpolation. Note, that if this calls<br />
index.default this gives an equidistant spacing 1:NROW(object). If object is a matrix or<br />
data.frame, the interpolation is done separately for each column.<br />
If obj is a plain vector then na.approx(obj, x, y, xout, ...) returns approx(x = x[!na], y = coredata(obj)[!na<br />
(where na indicates observations with NA) such that xout defaults to x.