I have a big dataframe with columns such as:
ID, time, OS, IP
Each row of that dataframe corresponds to one entry. Within that dataframe for some IDs several entries (rows) exist. I would like to get rid of those multiple rows (obviously the other attributes will differ for the same ID). Or put different: I only want one single entry (row) for each ID.
When I use unique
on the ID column, I only receive the levels (or each unique ID), but I want to keep the other attributes as well.
I have tried to use apply(x,2,unique(data$ID))
, but this does not work either.
If you want to keep one row for each ID, but there is different data on each row, then you need to decide on some logic to discard the additional rows. For instance:
Now I will keep the maximum time value and the last OS value:
Should do the trick