gapfill: Interpolate, subsample and fill gaps in time series by linear...

Description Usage Arguments Details Value Author(s) Examples

View source: R/ConvenienceFunctions.R

Description

Interpolate, subsample and fill gaps in time series by linear interpolation

Subsample and interpolate oversampled or undersampled time series to obtain equidistant data at a lower or higher sampling frequency. Gaps are filled with linear interpolation

Usage

1
2
3
4
5
6
gapfill(x, dt = x[2, 1] - x[1, 1], units = c("auto", "secs", "mins",
  "hours", "days", "weeks"), type = "linear")

subsample(x, dt, units = c("auto", "secs", "mins", "hours", "days", "weeks"))

resample(x, dt, units = c("auto", "secs", "mins", "hours", "days", "weeks"))

Arguments

x

Data frame with time in first column and time series data in second.

dt

Sampling interval. Default to time difference of first two observations

units

Optional: units of dt. Only necessary when time is of class POSIXt and dt is not of class difftime.

type

Type of interpolation. Only linear interpolation implemented

Details

Subsampling, interpolating and gapfilling

An equidistant times series with sampling interval dt is created by linear interpolation. gapfill takes the time interval between the first and second observation as default value for dt. subsample and resample require a value of dt.

Value

A data frame with time and interpolated time series.

Author(s)

Tom Cox <tom.cox@uantwerp.be>

Examples

1
2
plot(Hoernum, type="p", xlim=as.POSIXct(c("2008-08-01","2008-09-30")))
points(gapfill(Hoernum), type="p", pch=20, col="red", cex=0.2)

GPPFourier documentation built on Sept. 22, 2017, 5:06 p.m.