There is a data set with leading and trailing rows that have a feature with zero value. How to drop such rows in an elegant way?
# Library
library(tidyverse)
# 1. Input
data.frame(
id = c(1:10),
value = c(0, 0, 1, 3, 0, 1, 2, 8, 9, 0))
# 2. Delete leading and trimming rows with 'value = 0'
# ...
# 3. Desired outcome
data.frame(
id = c(3:9),
value = c(1, 3, 0, 1, 2, 8, 9))
Thanks.