fillGap {oce} | R Documentation |
Fill a Gap in an oce Object
Description
Sequences of NA
values, are filled by linear interpolation between
the non-NA
values that bound the gap.
Usage
fillGap(x, method = c("linear"), rule = 1)
Arguments
x |
an oce object. |
method |
to use; see “Details”. |
rule |
integer controlling behaviour at start and end of |
Value
A new oce
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
, thenx
is returned unaltered.Only method
linear
is permitted now.
Author(s)
Dan Kelley
Examples
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))
[Package oce version 1.8-2 Index]