Re: [R] lag function row name with

2019-03-25 Thread Eric Berger
Hi John, dplyr::lag expects a vector. The following should work dplyr::lag(temp[,1],2) HTH, Eric On Mon, Mar 25, 2019 at 9:45 AM John wrote: > Hi, > >I have a dataset whose row names corresponds to months. When I apply lag > function (dplyr package) on this dataset, I get NAs with warning

[R] lag function row name with

2019-03-25 Thread John
Hi, I have a dataset whose row names corresponds to months. When I apply lag function (dplyr package) on this dataset, I get NAs with warning messages. Is there any lag function that carries out the lag but keep the row names? I will have two datasets. The dates of the datasets are not exact