tsutils (version 0.9.0)

leadtrail: 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.

Examples

Run this code
# NOT RUN {
x <- c(rep(0,5),rnorm(100),rep(0,5))
leadtrail(x)

# }

Run the code above in your browser using DataCamp Workspace