fillGap {oce} | R Documentation

## Fill a gap in an oce object

### Description

Fill a gap in an oce object

### 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 `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.

### Details

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

### Value

A new `oc` object, with gaps removed.

### Bugs

1. 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.

2. If the first or last point is `NA`, then `x` is returned unaltered.

3. Only method `linear` works now, and that argument is ignored at present.

### 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 0.9-18 Index]