I am trying to generate lagged variable in R using the following code
  library(dpylr)
  dataretail<-dataretail %>%
      group_by(PERMNO) %>%
           mutate(newsheat_lag = lag(newsheat, n = 1,order_by = YYYYQ,default = NA)
but for some reason my lagged variable is identical to the original one. The same code used to work correctly a few months ago. Any idea what is going wrong?
 
    