powered by
Remove leading or trailing zeros or NAs from a vector.
leadtrail( x, rm = c("zeros", "na"), lead = c(TRUE, FALSE), trail = c(TRUE, FALSE) )
Resulting vector.
vector of values to check.
what to remove, can be "zeros" or "na".
"zeros"
"na"
If TRUE, then leading values are removed.
TRUE
If TRUE, then trailing values are removed.
Nikolaos Kourentzes, nikolaos@kourentzes.com.
x <- c(rep(0,5),rnorm(100),rep(0,5)) leadtrail(x)
Run the code above in your browser using DataLab