Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuzzy matching spatial admin names #83

Open
OJWatson opened this issue Mar 14, 2019 · 0 comments
Open

fuzzy matching spatial admin names #83

OJWatson opened this issue Mar 14, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@OJWatson
Copy link
Collaborator

When the spatial files have been added to rdhs, there will probably be a good use for some fuzzy mathcing of admin names etc.

So remember to add this in, with something like:

match_clean <- function(a,b){
  a <- gsub("[[:punct:][:space:]]","",tolower(stringi::stri_trans_general(a, "latin-ascii")))
  b <- gsub("[[:punct:][:space:]]","",tolower(stringi::stri_trans_general(b, "latin-ascii")))
  ret <- match(a,b)
  if(sum(is.na(ret)>0)){
    dists <- stringdist::seq_distmatrix(lapply(a,utf8ToInt),lapply(b,utf8ToInt))
      ret[is.na(ret)] <- apply(dists[which(is.na(ret)),,drop=FALSE],1,which.min)
    print(unique(cbind(a,b[ret])))
  }
  return(ret)
}
@OJWatson OJWatson added the enhancement New feature or request label Mar 14, 2019
OJWatson added a commit that referenced this issue Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant