na.trim {soundgen}R Documentation

Trim leading and trailing NAs

Description

Internal soundgen function. Nearly 10 times faster than zoo::na.trim. Slightly slower solution: a[!cumprod(is.na(a)) & rev(!cumprod(is.na(rev(a))))]. See https://stackoverflow.com/questions/42759027/remove-leading-and-trailing-na

Usage

na.trim(x)

Arguments

x

numeric vector

Examples

soundgen:::na.trim(c(NA, NA, 1:10, NA, 21:25, NA))

[Package soundgen version 2.7.1 Index]