I'm wondering if there's an easy way to compare columns before doing a join in dplyr. Below are two simple dataframes. I want to join based on first and last names, however there are some spelling mistakes or different formats, such as "Elizabeth Ray" vs "Elizabeth".
I would like to compare these columns before joining. Is there a way to use a match function or set operation, like intersect, etc, to look for names that don't have matches in both columns? I just want a list of the names that are different so I can manually correct them before joining.
I would like a solution based on dplyr, tidyr, and stringr.
FirstNames<-c("Chris","Doug","Shintaro","Bubbles","Elsa")
LastNames<-c("MacDougall","Shapiro","Yamazaki","Murphy","Elizabeth Ray")
Pets<-c("Cat","Dog","Cat","Dog","Cat")
Names1<-data.frame(FirstNames,LastNames,Pets)
FirstNames2<-c("Chris","Doug","Shintaro","Bubbles","Elsa")
LastNames2<-c("MacDougal","Shapiro","Yamazaku","Murphy","Elizabeth")
Dwelling<-c("House","House","Apartment","Condo","House")
Names2<-data.frame(FirstNames2,LastNames2,Dwelling)