How to compare datetime in r?