r code to merge and disambiguate datasets