signal_fill: Fill NA-gaps of a signal

View source: R/signal_fill.R

signal_fillR Documentation

Fill NA-gaps of a signal

Description

This function performs linear interpolation of NA values or pads them with zeros.

Usage

signal_fill(data, method = "linear")

Arguments

data

eseis object, numeric vector or list of objects, data set to be processed.

method

Character value, method to use for filling the data gap. One out of "linear" (linear interpolation) and "zeros" (padding with zeros). Default is "linear".

Details

Note that the procedure will contaminate the signal by artefacts as increasingly larger data gaps are filled with interpolated or zero values.

Value

eseis object, numeric vector or list of objects, gap-filled data set(s).

Author(s)

Michael Dietze

Examples


## create synthetic data set and add NA-gaps
data(rockfall)
x <- rockfall_z[25000:26000]
x_gap <- x
x_gap[100:102] <- NA
x_gap[500:530] <- NA

## fill gaps
y <- signal_fill(data = x_gap)

## plot filled data set
plot(y, type = "l")

## filter both data sets
x <- signal_filter(data = x, f = c(1, 3), dt = 1/200, lazy = TRUE)
y <- signal_filter(data = y, f = c(1, 3), dt = 1/200, lazy = TRUE)

## plot both data sets
plot(y, type = "l", col = "grey", lwd = 3)
lines(x, col = "red")


coffeemuggler/eseis documentation built on Nov. 25, 2024, 8:31 p.m.