Introduction to the problem
I have a dataset that is composed of two datasets. One contains baseline data (t1), the other contains follow-up data(t2). Not all cases in the baseline data are present in the follow-up data and not all cases in the follow-up data are present in the baseline data.
Aim
I would like to select only those cases that are present in both datasets. For this purpose I combined both data sets.
Example of data
ID Tn Score 1 ...... Score n
1 1 t1 1 ...... n
2 1 t2 1 ...... n
3 2 t1 1 ...... n
4 3 t2 2 ...... n
5 4 t1 3 ...... n
6 4 t2 1 ...... n
7 5 t1 2 ...... n
8 6 t2 1 ...... n
9 7 t1 5 ...... n
10 7 t2 4 ...... n
In my example (above) I thus would like cases 1, 4, and 7 for subsequent analyses.
What I have tried
I tried working with unique() and duplicated(), but so far I have not found a working solution.