mtime Speed
04:27:00.000 83,0903472900391
04:28:00.000 90,4319076538086
04:28:00.000 83,3221054077148
I need to remove the duplicates on the mtime column in R by using the condition of the maximum value for speed. the resulting table should look like this.
mtime Speed
04:27:00.000 83,0903472900391
04:28:00.000 90,4319076538086
There can be more than one duplicate value for time but it should remove all the values except the one with the highest speed.
k<- filter(kj, unique(mtime), max(vPkwCommon))
when I tried this using dplyr, it returned "Error: ‘max’ not meaningful for factors"
Any suggestions?
mtimecolumn to character or to a time object. Use for exampleas.character(d$mtime)dplyr, butdata.tablesolution would besetDT(kj); kj[, max(as.character(as.numeric(Speed))), by = mtime]