trim_trailing: Strip leading / trailing zeros

Description Usage Arguments Value Author(s) References Examples

View source: R/trim_trailing.R

Description

Removes value from rightmost/leftmost elements of a vector.

Usage

1
2
3
trim_trailing(x, value = 0)

trim_leading(x, value = 0)

Arguments

x

a vector

value

a value to strip from x

Value

a new vector, with values at the right removed

Author(s)

Neal Fultz

References

https://stackoverflow.com/questions/24009982/remove-zeros-in-the-start-and-end-of-a-vector/

Examples

1
trim_leading(c(0,0,0,0,1:5))

stackoverflow documentation built on Jan. 10, 2020, 9:07 a.m.