I am trying to merge two datasets (Datasets A and B) but when I merge Dataset A (407 Obs) with Dataset B (1462 Obs) I merged them by:
C <- merge(A, B, by=ID, all.x=TRUE)
It creates 416 observations in Dataset C.
Is there a reason why?
I am trying to merge two datasets (Datasets A and B) but when I merge Dataset A (407 Obs) with Dataset B (1462 Obs) I merged them by:
C <- merge(A, B, by=ID, all.x=TRUE)
It creates 416 observations in Dataset C.
Is there a reason why?
See Why does the result from merge have more rows than original file?.
Looks like there were multiple matches in the ID column. Since you didn't specify what your goal is, I recommend going through the full documentation: https://www.rdocumentation.org/packages/base/versions/3.4.1/topics/merge