I am trying to left join table 1 'Person Name' to table 2 'Name' and get the values from the Work Group column in Table 2
df1 <- read.table(text="
Person_Name
PEREZ, MINDY
PEREZ, ABA
CLARKE, LINDA
THOMAS, NICOLE", header=T, sep="|")
df2 <- read.table(text=
'Name Work_Group
"Perez-Tie, Mindy" "Group A"
"Rulnick-Perez, Aba" "Group C"
"Mcabe-Clarke, Linda" "Group A"
"Thomas, Nicole" "Group B"', header=T)
This is my current code however it does not show any matches. I am not sure what i might be doing wrong but any help would be great!!
ci_str_detect <- function(x, y){str_detect(x, regex(y, ignore_case = TRUE))}
result <- fuzzy_left_join(Table1,Table2, by = c("Person_Name" = "Name"),
match_fun = ci_str_detect ) %>%
select(PersoN_Name,Name,Work_Group)
print(result)


Here's working code:
The problem with the code you have is that in short, the strings don't match. Take for example the first row: "perez, mindy" will not match "perez-tie, mindy", nor the reverse (both have been shown here lowercase to make it more obvious). You want to match the first names and last names separately.
Another thing you can look at is the
stringdist_joinfunction from thefuzzyjoinpackage (I wasn't able to get it working correctly for all the rows, but it might be useful in your case)