I have this dataframe in R
   id      a        b        c        d
1  42      3        2       NA        5
2  42     NA        6       NA        6
3  42      1       NA        7        8
With function like this
library(dplyr)
dataframe %>%
 mutate(e = lead(d)) 
I get at third row NA since there is not fourth row, but how can I get value from first row - 5? Result should look like this
   id      a        b        c        d         e
1  42      3        2       NA        5         6
2  42     NA        6       NA        6         8
3  42      1       NA        7        8         5
 
    