The data frame df has 2 variables---the 1st column is id, and the 2nd column is ladies' English proficiency (lep).
Now, I want to create a new column called sign with the rule----if there are zero(s) between the 1st 1 and the last 1 in lep variable, then sign=1, otherwise sign=0. Any helps will be appreciated!

```
structure(list(id = c(3831001, 3831001, 3831001, 3831001, 3831001, 
3831001, 3831001, 3831001, 3831002, 3831002, 3831002, 3831002, 
3831002, 3831002, 3831002, 3831002, 3831003, 3831003, 3831003, 
3831003, 3831003, 3831003, 3831003, 3831003, 3831004, 3831004, 
3831004, 3831004, 3831004, 3831004, 3831005, 3831005, 3831005, 
3831005, 3831005, 3831005, 3831005, 3831006, 3831006, 3831006, 
3831006, 3831006, 3831006, 3831007, 3831007, 3831007, 3831007, 
3831007, 3831007, 3831007, 3831007), lep = c(1, 1, 1, NA, NA, 
0, NA, 0, 1, 1, 0, 1, 0, 0, NA, 1, 1, 0, 0, 0, NA, 1, 0, NA, 
1, 0, NA, 1, 0, NA, 1, NA, NA, 0, NA, NA, 1, 1, 0, NA, 0, 0, 
0, 1, 0, 0, 0, 0, NA, NA, 1)), row.names = c(NA, -51L), groups = structure(list(
    id = c(3831001, 3831002, 3831003, 3831004, 3831005, 3831006, 
    3831007), .rows = structure(list(1:8, 9:16, 17:24, 25:30, 
        31:37, 38:43, 44:51), ptype = integer(0), class = c("vctrs_list_of", 
    "vctrs_vctr", "list"))), row.names = c(NA, 7L), class = c("tbl_df", 
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df", 
"tbl_df", "tbl", "data.frame"))->df

#.The expected result is as follows,
id        lep sign

3831001    1   0

3831001    1   0

3831001    1   0

3831001    NA  0

3831001    NA  0

3831001    0   0

3831001    NA  0

3831001    0   0

3831002    1   1

3831002    0   1

3831002    0   1

3831002    1   1

3831002    0   1

3831002    0   1

3831002    NA  1

3831002    1   1

...............

3831006    1   0

3831006    0   0

3831006    NA  0

3831006    0   0

3831006    0   0

3831006    0   0

3831007    1   1

3831007    0   1

3831007    0   1

3831007    0   1

3831007    0   1

3831007    NA  1

3831007    NA  1

3831007    1   1

```