leadtrail {tsutils}R Documentation

Remove leading/training zeros/NAs

Description

Remove leading or trailing zeros or NAs from a vector.

Usage

leadtrail(
  x,
  rm = c("zeros", "na"),
  lead = c(TRUE, FALSE),
  trail = c(TRUE, FALSE)
)

Arguments

x

vector of values to check.

rm

what to remove, can be "zeros" or "na".

lead

If TRUE, then leading values are removed.

trail

If TRUE, then trailing values are removed.

Value

Resulting vector.

Author(s)

Nikolaos Kourentzes, nikolaos@kourentzes.com.

Examples

x <- c(rep(0,5),rnorm(100),rep(0,5))
leadtrail(x)


[Package tsutils version 0.9.4 Index]