I am fairly new to R and I have a question on how to keep only certain values based on an ID and a date. I have a (quite big) dataset that looks like the following example:
ID Type Date
1 OUT 2016-06-18
1 OUT 2016-06-18
1 OUT 2016-06-18
1 IN 2016-06-25
1 OUT 2016-06-25
2 IN 2016-07-03
2 OUT 2016-07-03
My question now is how can I find dates that contain ONLY one of the types (IN or OUT) and remove those from the data. I would however like to keep the date if the type is a pair (IN and OUT) and if the ID value is the same.
Is there a way how to do this in R?