Skip to contents

Overwriting spectral data with interpolated values at wavelengths values containing bad data is needed when cleaning spectral data. This function differs from insert_hinges() in that it returns a vector of y values instead of a tibble.

Overwriting spectral data with interpolated values at wavelengths values containing bad data is needed when cleaning spectral data. Linear interpolation between the two enclosing neighbours is used as replacement values. This function like v_insert_hinges() returns a vector of new y values.

Usage

v_replace_hinges(x, y, h)

v_replace_hinges(x, y, h)

Arguments

x

numeric vector (sorted in increasing order).

y

numeric vector.

h

a numeric vector giving the wavelengths at which the y values should be replaced by interpolation, no interpolation is indicated by an empty numeric vector (numeric(0)).

Value

A numeric vector with the numeric values of y with values at the hinges replaced by interpolation of neighbours.

A copy of the numeric vector y with values at the hinges replaced by interpolation of neighbours. The lengths of x, y and the returned vector are the same.