I have this dataset:
[TABLE="width: 682"]
<tbody>[TR]
[TD]User[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]8:00 AM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]10:00 AM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]4:00 PM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]8:00 AM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]5:00 PM[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]9:00 AM[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]3:00 PM[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[/TR]
</tbody>[/TABLE]
The first thing I want to do is add a subindex on User and Date.
[TABLE="width: 682"]
<tbody>[TR]
[TD]User[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[TD]User/Date Index[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]8:00 AM[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]10:00 AM[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]4:00 PM[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]8:00 AM[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]5:00 PM[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]9:00 AM[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]3:00 PM[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]
The second thing I want is a column that takes the difference between times in its row (A) and the row after it (A+1). "n/a" means I don't really care about this value. I just want the interday marginal differences.
[TABLE="width: 682"]
<tbody>[TR]
[TD]User[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[TD]User/Date Index[/TD]
[TD]Marginal Difference[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]8:00 AM[/TD]
[TD]1[/TD]
[TD]02:00:00[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]10:00 AM[/TD]
[TD]2[/TD]
[TD]06:00:00[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]4:00 PM[/TD]
[TD]3[/TD]
[TD]01:00:00[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[TD]4[/TD]
[TD]n/a[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]8:00 AM[/TD]
[TD]1[/TD]
[TD]09:00:00[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]5:00 PM[/TD]
[TD]2[/TD]
[TD]n/a[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]9:00 AM[/TD]
[TD]1[/TD]
[TD]06:00:00[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]3:00 PM[/TD]
[TD]2[/TD]
[TD]02:00:00[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[TD]3[/TD]
[TD]n/a[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 682"]
<tbody>[TR]
[TD]User[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]8:00 AM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]10:00 AM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]4:00 PM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]8:00 AM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]5:00 PM[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]9:00 AM[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]3:00 PM[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[/TR]
</tbody>[/TABLE]
The first thing I want to do is add a subindex on User and Date.
[TABLE="width: 682"]
<tbody>[TR]
[TD]User[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[TD]User/Date Index[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]8:00 AM[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]10:00 AM[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]4:00 PM[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]8:00 AM[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]5:00 PM[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]9:00 AM[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]3:00 PM[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]
The second thing I want is a column that takes the difference between times in its row (A) and the row after it (A+1). "n/a" means I don't really care about this value. I just want the interday marginal differences.
[TABLE="width: 682"]
<tbody>[TR]
[TD]User[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[TD]User/Date Index[/TD]
[TD]Marginal Difference[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]8:00 AM[/TD]
[TD]1[/TD]
[TD]02:00:00[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]10:00 AM[/TD]
[TD]2[/TD]
[TD]06:00:00[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]4:00 PM[/TD]
[TD]3[/TD]
[TD]01:00:00[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[TD]4[/TD]
[TD]n/a[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]8:00 AM[/TD]
[TD]1[/TD]
[TD]09:00:00[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]9/2/2019[/TD]
[TD]5:00 PM[/TD]
[TD]2[/TD]
[TD]n/a[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]9:00 AM[/TD]
[TD]1[/TD]
[TD]06:00:00[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]3:00 PM[/TD]
[TD]2[/TD]
[TD]02:00:00[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]9/1/2019[/TD]
[TD]5:00 PM[/TD]
[TD]3[/TD]
[TD]n/a[/TD]
[/TR]
</tbody>[/TABLE]