Created
October 2, 2012 03:00
-
-
Save mgcdanny/3815922 to your computer and use it in GitHub Desktop.
Fuzzy Variable Name Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Variable Name Checking ########## | |
pop = read.csv("H:\\file1.csv", head=T, as.is=T) | |
sam = read.csv("H:\\file2_vars_10.csv", head=T, as.is=T) | |
p = pop$NAME[!(pop$NAME %in% sam$NAME)] | |
s = sam$NAME[!(sam$NAME %in% pop$NAME)] | |
res = data.frame() | |
for (i in 1:length(p)) { | |
for (j in 1:length(s)) { | |
temp = adist(p[i],s[j]) | |
if(temp < 4) res = rbind(res,cbind(temp,p[i],s[j])) | |
} | |
} | |
View(res[order(res[1], decreasing=T),]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment