I've looked at a number of threads and can't quite find what I'm looking for. I have a dataset with multiple ids and dates like the below.
id  date       code
1   2000-10-08  690
1   2000-10-08  75
1   2000-10-08  35
1   2001-01-01  315
1   2001-01-01  70
1   2008-09-05  690
1   2008-09-05  5
1   2008-09-05  60
2   2006-02-01  188
2   2006-02-01  198
2   2006-02-01  555
2   2006-02-01  690
3   2010-10-10  120
3   2010-10-10  75
3   2010-10-10  25
I don't want duplicate dates per id and want to select this based on lowest code value so it would end up like this:
id  date       code
1   2000-10-08  35
1   2001-01-01  70
1   2008-09-05  5
2   2006-02-01  188
3   2010-10-10  25
I've used the group_by function so that it treats data by id and date:
df %>%
 group_by(id, date) %>%
 arrange(code)
However, I'm struggling to work out what code to use so as to now keep only the lowest value of each id/date combination.
Could anyone help me with this?
Thanks
 
     
     
     
     
    