Learn R Programming

oce (version 0.1-82)

fill.gap: Fill a gap in an oce object

Description

Fill a gap in an oce object

Usage

fill.gap(x, method=c("linear"))

Arguments

x
an oce object.
method
to use; see Details.

Value

  • A new oc object, with gaps removed.

Bugs

{Eventually, this will be expanded to work with any oce object. But, for now, it only works for vectors that can be coerced to numeric.} {If the first or last point is NA, then x is returned unaltered.} {Only method linear works now, and that argument is ignored at present.}

Details

Sequences of NA values, are filled by linear interpolation between the non-NA values that bound the gap.

Examples

Run this code
library(oce)
# Integers
x <- c(1:2, NA, NA, 5:6)
y <- fill.gap(x)
print(data.frame(x,y))
# Floats
x <- x + 0.1
y <- fill.gap(x)
print(data.frame(x,y))

Run the code above in your browser using DataLab