Displaying 1 result from an estimated 1 matches for "matoga".
Did you mean:
matoba
2012 Nov 15
3
Can you have a by variable in Lag function as in SAS
Hello,
I want to use lag on a time variable but I have to take date into
consideration ie I don't want days to overlap ie:
I don't want my first time of today to match my last time of yeterday.
In SAS I would use :
data x;
set y;
by date tim;
previous=lag(tim);
if first.date then
do;
previous=.;
end;
run;
How can I do something similar in R? I can't find