powered by
Fuzzy join data to boundaries by name
mn_fuzzy_join_by_name( data, name_col, level = "ADM1", boundaries = NULL, max_distance = 2, method = c("osa", "lv", "jw", "dl") )
sf with best fuzzy matches joined.
Data frame with a name column.
Column in data containing names.
data
Boundary level.
Optional pre-fetched boundaries.
Maximum string distance for a match (default 2).
Distance method passed to stringdist::stringdist.
stringdist::stringdist
# Join even with minor spelling differences pop_data <- data.frame(aimag = c("Ulanbatar", "Darhan"), pop = c(1500000, 100000)) sf_joined <- mn_fuzzy_join_by_name(pop_data, "aimag", level = "ADM1")
Run the code above in your browser using DataLab