I would like to do a merge between two dataframes and in case NA occurs, go back and generate another merge but with other keys (both df).
i just do a simple merge:
e0 <- merge(x= e0,y= mz[,c("Z","ED","GG","DD")],
by.x ="Z",by.y = "Z",all.x=T, all.y = F)
but the key of e0 has some NA and to complete the information it requires another key of e0 (A). in the same way it would be necessary to change the key to mz.
the structure of e0 is:
Z A
34 NA
45 NA
NA 32
NA 28
So should be able to do the merge depending on the key. And the result must be like:
Z A ED GG DD
34 NA AB 13 BN
45 NA ZF 16 BS
NA 32 CD 21 OR
Na 28 AB 23 CN
As if it were an excel type if.error(vlooup, vlooup)
Thanks...