Learn R Programming

oce (version 0.1-76)

fill.gap: Fill a gap in an oce object

Description

Fill a gap in an oce object

Usage

fill.gap(x, start, end, column)

Arguments

x
an oce object.
start
the start of the bad section of data (see details).
end
the start of the bad section of data (see details).
column
if provided, the name of the column referred to by start and end.

Value

  • A new oce object.

Details

Gaps in the data (i.e. columns in x$data) are filled by linear interpolation between the start and end points. If column is not provided, then start and end are indices. If column is provided, then start and end refer to values in the named column.

Examples

Run this code
library(oce)
data(tdr)
d <- subset(tdr, as.POSIXct("2008-06-26") <= t & t <= as.POSIXct("2008-06-27"))
plot(d$data$t, d$data$temperature, type="l", lwd=2, xlab="t", ylab="Temperature [degC]")
dd <- fill.gap(d, as.POSIXct("2008-06-26 09:00:00"), as.POSIXct("2008-06-26 20:00:00"), "t")
lines(dd$data$t, dd$data$temperature, col="red")
abline(v=as.POSIXct("2008-06-26 09:00:00"), col="pink")
abline(v=as.POSIXct("2008-06-26 20:00:00"), col="pink")

Run the code above in your browser using DataLab