Is there a package or method to set some 'rules' for R to follow when using inner_join.
I have a dataset where the way the id for some observations is written is different in one dataset to another. For example "Example A Twp" in dataset 1 = "Example A Township" in dataset 2 I would want to set the rule "Twp" == "Township" along with some other rules.
Here is some example data
setting some sort of equivalent rule would be better for me than simply using str_remove(" twp") since there are some observations in the data with similar names
name <- c("hamilton twp", "wayne", "berwick", "east wenatchee", "north bergen", "toms river", "parsippany-troyhills")
value1 <- c(1, 5, 2, 4, 2, 5, 2)
data1 <- data.frame(name, value1)
name <- c("hamilton", "wayne township", "berwick borough", "east wenatchee city", "north bergen township", "toms river township", "parsippany-troyhills twp")
value2 <- c(1, 3, 3, 4, 2, 3, 2)
data2 <- data.frame(name, value2)