title: How to use compare.linkage in the R package RecordLinkage -- unexpected output
body: <p>I am using the compare.linkage function in the R package RecordLinkage,
  and getting a result I know is wrong, so I know I'm misunderstanding something.
  I am using R 3.2.3 for x64 Windows. I am very familiar with Stata but not so much with R. I just cross-posted at r-help.</p>
  
  <p>I can create record pairs from the blocking fields but all pairs are unknown status (NA). I cannot create matches or non-matches. I want a simple working example of how to link datasets using the RecordLinkage package. It seems that the manual and the R Journal Vol. 2/2 only show how to de-duplicate a single dataset using the compare.dedup function, not how to link two datasets together using the compare.linkage function. I can reproduce the examples in the R Journal article, so my R installation is fine.</p>
  
  <p>The example dataset in the manual have 500 and 10000 observations on 7 variables, but 1 observation and 2 variables will be enough to show the problem.
  My first comparison pattern loooks like this:</p>
  
  <pre><code>  id1  id2 fname_c1 bm is_match
  1  17  343        1  1       NA
  </code></pre>
  
  <p>Instead, I want and expect a comparison pattern that looks like this:</p>
  
  <pre><code>  id1  id2 fname_c1 bm is_match
  1  17  343        1  1       1
  </code></pre>
  
  <p>My blocking variable is fname_c1 for first component of first name. My matching variable is bm for birth month. My understanding is that row 1 in my example output is the first row where fname_c1 matched in the underlying datasets. I want and expect is_match to be 1 when the matching variable bm=1 in both linkage datasets, as in the example.</p>
  
  <p>For more details, this is what I typed and the R output:</p>
  
  <pre><code>&gt; library(RecordLinkage)
  &gt; data(RLdata500)
  &gt; data(RLdata10000)
  &gt; RLdata500[17, ]
      fname_c1 fname_c2 lname_c1 lname_c2   by bm bd
  17 ALEXANDER     &lt;NA&gt;  MUELLER     &lt;NA&gt; 1974  9  9
  &gt; RLdata10000[343, ]
       fname_c1 fname_c2 lname_c1 lname_c2   by bm bd
  343 ALEXANDER     &lt;NA&gt;  BAUMANN     &lt;NA&gt; 1957  9  7
  &gt; rpairs &lt;- compare.linkage(RLdata500,RLdata10000,blockfld=c(1),     exclude=c(2:5,7))
  &gt; rpairs$pairs[c(1:2), ] # Why is_match=NA? (should be 1)
    id1  id2 fname_c1 bm is_match
  1  17  343        1  1       NA
  2  17 2385        1  0       NA
  &gt; rpairs &lt;- epiWeights(rpairs) # (Weight calculation)
  &gt; summary(rpairs) # (0 matches in Linkage Dataset)
  
  Linkage Data Set
  
  500 records in data set 1 
  10000 records in data set 2 
  47890 record pairs 
  
  0 matches
  0 non-matches
  47890 pairs with unknown status
  
  
  Weight distribution:
  [omitted here to save space]
  </code></pre>
  
  <p>References:</p>
  
  <ol>
  <li><p>Manual for Package ‘RecordLinkage’
  (Available online in PDF at
  <a href="https://cran.r-project.org/web/packages/RecordLinkage/RecordLinkage.pdf" rel="nofollow">https://cran.r-project.org/web/packages/RecordLinkage/RecordLinkage.pdf</a>)</p></li>
  <li><p>R Journal article Article "The RecordLinkage Package: Detecting Errors in Data" 
  (Available online in PDF at
  <a href="https://journal.r-project.org/archive/2010-2/RJournal_2010-2_Sariyar+Borg.pdf" rel="nofollow">https://journal.r-project.org/archive/2010-2/RJournal_2010-2_Sariyar+Borg.pdf</a>)</p></li>
  </ol>
  
  <p>I saw something in the manual and R journal article about identity argument for true match results, but I guess I only need that for reference ("gold standard") datasets. There is a non-missing value (bm=1) for my example in both underlying datasets, so that is not why the result is NA. What am I missing? How does one link two simple datasets using compare.linkage in R? </p>
  
  <p>Anders Alexandersson</p>
  
  <p>andersalex@gmail.com</p>