library(dplyr)
if (requireNamespace("ggplot2", quietly = TRUE)) {
diamonds <- tibble::as_tibble(ggplot2::diamonds)
d <- tibble::tibble(approximate_name = c("Idea", "Premiums", "Premioom",
"VeryGood", "VeryGood", "Faiir"),
type = 1:6)
# no matches when they are inner-joined:
diamonds %>%
inner_join(d, by = c(cut = "approximate_name"))
# but we can match when they're fuzzy joined
diamonds %>%
stringdist_inner_join(d, by = c(cut = "approximate_name"))
}
Run the code above in your browser using DataLab