Does anyone have an explanation for this result with the package dplyr?
I have data.frame df
library(dplyr)
df = data_frame(
'id' = c(1,2,2,2,2,3,3,3,3),
'start' = c(881, 1611, 1611, 1642, 1764, 0, 0, 28, 59),
'end' = c(1089, 1819, 1819, 1850, 1972, 208, 208,236, 267))
It looks like
After grouping with idand applying lag in the final column, I expected that there idwould be none for each .
df %>%
group_by(id) %>%
mutate(end.prev = lag(end))
But I
I am using the latest version available in cran dplyr 0.4.3 (my version is R 3.2.5)
source
share