title: To merge values from another dataframe based on partial string match while the matching column is not in same order
body: <p>I want to merge one column from <code>df2</code> with <code>df1</code> by matching <code>df1$District_name</code> and <code>df2$Districts</code>.
   But the character values in <code>df1$District_name</code> and <code>df2$Districts</code> are not in the same order and <code>df1</code> and <code>df2</code> are not of same length.
   The values do not match exactly. <code>df1</code> has more rows than <code>df2</code>, so the corresponding values for those extra district names should be zero.</p>
  
  <pre><code> df1=data.frame(State_name=c("Maharashtra","Andhra Pradesh","Bihar","Bihar","West Bengal","Gujarat","Gujarat","Assam"),
             District_name=c("Nashik","Chittoor","Madhepura","Kishanganj","Howrah","Gandhinagar","Ahmadabad","Sivasagar"),
             Value1=c(5,3,6,4,4,3,2,4))
  
  df2=data.frame(Districts=c("Nashik","Chitoor","Kishanganj","Madhepur","Sibhasagar","Ahmadabad"),
             FinanceIndex=c(0.20975,0.12187,0.37155,0.66128,0.10918,0.54730))
  
  
  # df1
        State_name District_name Value1
  1    Maharashtra        Nashik      5
  2 Andhra Pradesh      Chittoor      3
  3          Bihar     Madhepura      6
  4          Bihar    Kishanganj      4
  5    West Bengal        Howrah      4
  6        Gujarat   Gandhinagar      3
  7        Gujarat     Ahmadabad      2
  8          Assam     Sivasagar      4
  
  # df2
        Districts FinanceIndex
  1        Nashik      0.20975
  2       Chitoor      0.12187
  3    Kishanganj      0.37155
  4      Madhepur      0.66128
  5    Sibhasagar      0.10918
  6     Ahmadabad      0.54730
  </code></pre>
  
  <p>I used match function but due to the spelling differences, I am getting most of them as zero values.</p>
  
  <pre><code>index&lt;-match(df1$District_name, df2$Districts)
  df1$finindex=df2$FinanceIndex[index]
  df1$finindex[is.na(df1$finindex]=0
  </code></pre>
  
  <p>For String matching, I found this function which matches similar phonetic words:</p>
  
  <pre><code>library(RecordLinkage)
  soundex('Nellore')==soundex('Vellore')
  #FALSE
  </code></pre>
  
  <p>The output should be :</p>
  
  <pre><code># df1
       State_name District_name Value1 finindex
  1    Maharashtra        Nashik      5  0.20975
  2 Andhra Pradesh      Chittoor      3  0.12187
  3          Bihar     Madhepura      6  0.66128
  4          Bihar    Kishanganj      4  0.37155
  5    West Bengal        Howrah      4  0.00000
  6        Gujarat   Gandhinagar      3  0.00000
  7        Gujarat     Ahmadabad      2  0.54730
  8          Assam     Sivasagar      4  0.10918
  </code></pre>
  
  <p>Is there any way these two functions can be used together to solve the problem? Or any other way to solve the problem?</p>