intplNA: Interpolate NAs

View source: R/utilities_pitch_postprocessing.R

intplNAR Documentation

Interpolate NAs

Description

Internal soundgen function

Usage

intplNA(x, idx_na = NULL, nPoints = 1)

Arguments

x

numeric vector

idx_na

which(is.na(x))

nPoints

the number of points to use for interpolating leading and trailing NAs: 1 = constant interpolation, 2 = use the first two non-NAs at the beginning and the last two non-NAs at the end, etc.

Details

Takes a numeric vector and fills in the NAs by linear interpolation in the middle and constant or linear interpolation at the ends.

Value

Returns the same numeric vector with NAs filled in by interpolation.

Examples

soundgen:::intplNA(c(NA, 405, 441, 460, NA, NA, NA, 480, 490, NA, NA))
soundgen:::intplNA(c(NA, 405, 441, 460, NA, NA, NA, 480, 490, NA, NA), nPoints = 3)

soundgen documentation built on Aug. 14, 2022, 5:05 p.m.