fillGap(x, method=c("linear"), rule=1)
oce
object.x
. If
rule=1
, NA
values at the ends are left in the return value.
If rule=2
, they are replaced with the nearest non-NA point.oc
object, with gaps removed.oce
object. But, for now, it only works for vectors that can
be coerced to numeric.}
NA
, then x
is returned unaltered.}
linear
works now, and that argument is
ignored at present.}NA
values, are filled by linear
interpolation between the non-NA
values that bound the gap.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))
Run the code above in your browser using DataLab