Calculate Column Difference for other column levels where lag varies
I have a column :EVENT (character-nominal) with various values. Also another column :datetime (numeric-continuous). I have :datetime column sorted ascending. I am interested in having another column calculate for whenever there is a "CONNECT" event, what is the time difference between it and the last "DISCONNECT" event. The issue is that the lag can vary between a CONNECT and previous DISCONNE...