Learn R Programming

pastecs (version 1.3.21)

reglin: Regulation of a series using a linear interpolation

Description

Transform an irregular time series in a regular time series, or fill gaps in regular time series using a linear interpolation

Usage

reglin(x, y=NULL, xmin=min(x), n=length(x),
        deltat=(max(x) - min(x))/(n - 1), rule=1)

Value

An object of type 'regul' is returned. It has methods print(), summary(), plot(), lines(), identify(), hist(), extract() and specs().

Arguments

x

a vector with time in the irregular series. Missing values are allowed

y

a vector of same length as x and holding observations at corresponding times

xmin

allows to respecify the origin of time in the calculated regular time series. By default, the origin is not redefined and it is equivalent to the smallest value in x

n

the number of observations in the regular time series. By default, it is the same number than in the original irregular time series (i.e., length(x)

deltat

the time interval between two observations in the regulated time series

rule

the rule to use for extrapolated values (outside of the range in the initial irregular time series) in the regular time series. With rule=1 (by default), these entries are not calculated and get NA; with rule=2, these entries are extrapolated

Author

Frédéric Ibanez (ibanez@obs-vlfr.fr), Philippe Grosjean (phgrosjean@sciviews.org)

Details

Observed values are connected by lines and interpolated values are obtained from this "polyline".

See Also

regul, regarea, regconst, regspline, regul.screen, regul.adj, tseries, is.tseries

Examples

Run this code
data(releve)
reg <- reglin(releve$Day, releve$Melosul)
plot(releve$Day, releve$Melosul, type="l")
lines(reg$x, reg$y, col=2)

Run the code above in your browser using DataLab