I am attempting to re-map data to their encrypted IDs (I no longer have access to the mapping key that links the encrypted ID with the participant ID)
In my case, df1 has 95K rows and dh2=94K rows, both have identical columns (n=360). I want to merge df1 and df2 (with different number of observations) by all the columns.
For a reproducible example:
df1 = data.frame(PID=c(1:10),
Sex = c(rep("male", 4), rep("female", 6)),
Age=c(rep("35",2), "27" ,rep("28", 2), rep("50",2), rep("55", 1), "66", "54"))
df2 = data.frame(EID=c("PI_1234", "PI_1235", "PI_1236", "PI_1237", "PI_1238"),
Sex=c("female", "female", "male", "male", "female"),
Age=c("28", "50", "28", "27", "66") )
df3 =data.frame(PID=c(5, 7, 4, 3, 9),
EID=c("PI_1234", "PI_1235", "PI_1236", "PI_1237", "PI_1238"),
Sex=c("female", "female", "male", "male", "female"),
Age=c("28", "50", "28", "27", "66") )
I want to create df3 keeping all the observations that match (mapping the PID with the encrypted ID (EID)). Is this possible?