dated <- c("2020-01-01", "2020-01-02")
lat <- c(40, 41)
lon <- c(12,13)
mmsi <- c("34534555", "25634555")
hours <- c(0, 5)
fishing_hours <- c(1,9)
df <- data.frame(dated, lat, lon, mmsi, hours, fishing_hours)
who.fishs.the.most <- top.percent.by(df, 90, "fishing_hours")
print(who.fishs.the.most)
Run the code above in your browser using DataLab