My DF looks as follows:
date | customer_id | session_id | current_page | previous_page | ti_1
2016-02-14 16:37:00 | 9999 | ABC | STRING_A | STRING_B | STRING_C
2016-02-14 16:38:10 | 9999 | ABC | STRING_D | STRING_E | STRING_C
2016-02-14 16:38:40 | 9999 | ABC | STRING_F | STRING_G | STRING_C
I would like to always extract the last row (max(date)), per customer_id, session_id, ti_1. Hence, in my DF, I would like the answer to look like (as I am interested in "current_page" and "previous_page"):
2016-02-14 16:38:40 | 9999 | ABC | STRING_F | STRING_G | STRING_C
I have tried:
testi <- group_by(
DF, customer_id,session_id,
current_page,previous_page,ti_1)
testi_2 <- summarise(testi,max(date))
However, this does evidently not work, as R groups by each individual string and I suspect that I have to do this using window functions. How is this done?