Here is an example of my data set;
Date Time(GMT)Depth Temp Salinity Density Phosphate 24/06/2002 1000 1 33.855 0.01 24/06/2002
Introducing a data.table solution which will be the fastest way to solve this (assuming data is your data set)
data.table
data
library(data.table) unique(setDT(data)[order(Date, -Depth)], by = "Date")
Just another way:
setDT(data)[data[, .I[which.max(Depth)], by=Date]$V1]