gap.fill: Gap filling by linear interpolation

View source: R/gap.fill.R

gap.fillR Documentation

Gap filling by linear interpolation

Description

Fills gaps by linear interpolation between observations. This function provides the option to define the minimum window under which gaps should be filled, using linear interpolation.

Usage

gap.fill(input, max.gap = 60, decimals = 10, df = FALSE)

Arguments

input

an is.trex-compliant object.

max.gap

Numeric value providing the maximum size of a gap in minutes, which can be filled by performing a linear interpolation.

decimals

Integer value defining the number of decimals of the output (default = 10).

df

Logical; if TRUE, output is provided in a data.frame format with a timestamp and a value (\Delta T or \Delta V) column. If FALSE, output is provided as a zoo object (default = FALSE).

Value

A zoo object or data.frame in the appropriate format for further processing.

Examples


## Not run: 
# fill two hour gaps
raw   <- example.data(type = "doy")
input <-
  is.trex(
    raw,
    tz = "GMT",
    time.format = "%H:%M",
    solar.time = TRUE,
    long.deg = 7.7459,
    ref.add = FALSE,
    df = FALSE)

# create gaps in data
input[which(input < 0.4 | input > 0.82)] <- NA
fill_120 <- gap.fill(
  input = input,
  max.gap = 120,
  decimals = 10,
  df = FALSE)
fill_15 <- gap.fill(
  input = input,
  max.gap = 15,
  decimals = 10,
  df = FALSE)
  
## End(Not run)

the-Hull/TREX documentation built on Feb. 15, 2024, 9:13 a.m.