I have following dataframe in R
ID Date
1 01-01-2018
2 02-01-2018
3 03-01-2018
4 03-01-2018
5 03-01-2018
6 04-01-2018
7 04-01-2018
My desired dataframe is
ID Date Rank
1 01-01-2018 1
2 02-01-2018 2
3 03-01-2018 3
4 03-01-2018 3
5 03-01-2018 3
6 04-01-2018 4
7 04-01-2018 4
Rank should change when it encounters unique dates otherwise rank should be same.How can I do it in R ?