fillGap {oce} | R Documentation |
Sequences of NA
values, are filled by linear interpolation between
the non-NA
values that bound the gap.
fillGap(x, method = c("linear"), rule = 1)
x |
an |
method |
to use; see “Details”. |
rule |
integer controlling behaviour at start and end of |
A new oce
object, with gaps removed.
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
is permitted now.
Dan Kelley
library(oce) # Integers x <- c(1:2, NA, NA, 5:6) y <- fillGap(x) print(data.frame(x,y)) # Floats x <- x + 0.1 y <- fillGap(x) print(data.frame(x,y))