Learn R Programming

FIACH (version 0.1.2)

naSpline: Interpolate NAs

Description

This function interpolates NAs in matrices along columns.

Usage

naSpline(mat,maxgap=1)

Arguments

mat
A must be a numeric matrix.
maxgap
positive integer indicating over what gaps values can be interpolated. Longer gaps will be less accurate.

Value

Returns the interpolated matrix.

Examples

Run this code
x<-rnorm(100)
x[20]<-30
naData<-badData(x)
fixed<-naSpline(naData)
par(mfrow=c(2,1))
ts.plot(x)
ts.plot(fixed)

Run the code above in your browser using DataLab