fixNA: Fix NA values.

fixNAR Documentation

Fix NA values.

Description

Replace NA values in a time series with mean values between end points of missing segments, or first and last real values in case the NA's are at the beginning or ends of traces.

Usage

fixNA(y)

Arguments

y

numeric vector

Details

fixNA searches for stretches of NA 's in a time series and replaces the NA values with numeric values based ont he two end points of each section.

Value

numeric vector with no NA values.

Note

function is used primarily in filter applications.

Author(s)

Jonathan M. Lees<jonathan.lees@unc.edu>

See Also

butfilt

Examples


## source("~/Site/TA_DATA/CODE/fixNA.R")

### last samples are NA
zig = rnorm(25)
zig[10:15] = NA

noNA = fixNA(zig)

### first samples are NA
zig = rnorm(25)
zig[1:5] = NA
noNA = fixNA(zig)


zig = rnorm(25)
zig[1:5] = NA
zig[21:25] = NA

noNA = fixNA(zig)



zig = rnorm(25)
zig[1] = NA
zig[21:25] = NA
zig[10:12] = NA

noNA = fixNA(zig)
cbind(zig, noNA)





RSEIS documentation built on Sept. 13, 2024, 1:09 a.m.