I'm stuck with yet another list question. The basic gist: I have lists within a list like so:
list = {{"Joe", "Engineer", Mon 2 Oct 2017}, {"Joe", "Activist", Wed 3 Oct 2017}, {"Joe", "Doctor", Wed 18 Oct 2017}};
What I would like to do is return anything in the list where the date (third element in each nested list) is greater than 2 weeks after the date of the previous list (Mon 2 Oct 2017). As a result, I would obtain the list:
{"Joe", "Doctor", Wed 18 Oct 2017}
Because {"Joe","Activist", Wed 3 Oct 2017} is not 2 weeks after the previous list, {"Joe", "Engineer", Mon 2 Oct 2017}, but {"Joe", "Doctor", Wed 3 Oct 2017} is
I have written out a logical script to test whether the date of a list immediately after the first is after two weeks:
list1=list[[1]];
DatePlus[list1[[3]], 14] < Flatten[list[[Flatten[Position[list, list1]] + 1]]][[3]]
This returns False, indicating that the date in the second list is not 2 weeks greater than the date in the first list
Another check:
list2 = list[[2]];
DatePlus[list2[[3]], 14] < Flatten[list[[Flatten[Position[list, list2]] + 1]]][[3]]
This returns True, indicating that the date in the third list is greater than two weeks of the date of the second list.
My goal is to basically iterate this process throughout the entire list without having to do individual checks, and then to return the lists where the date-element is 2 two weeks greater than the date-element of its previous list. I imagine I would have to use the If function, but am not sure how to iterate this process first.
Any help would be greatly appreciated!