title: merging in R keeping all rows of a data set
body: <p>I have two data frames</p>
  
  <p>distinct_paper_year_data:</p>
  
  <pre><code>author_id      distinct_paper_year_count
       1                         3
       2                         1
       4                         1
       5                         4 
  </code></pre>
  
  <p>author_data:</p>
  
  <pre><code>author_id    paper_id  confirmed
     1         25733         1
     2         47276         1
     3         79468         1
     4         12856         0
  </code></pre>
  
  <p>Now I want to merge so that the desired output looks like:</p>
  
  <pre><code>author_id  paper_id     confirmed    distinct_paper_year_count
   1            25733          1               3
   2            47276          1               1 
   3            79468          1               0  
   4            12856          0               4
  </code></pre>
  
  <p>In this I need the <code>author_id</code>s present in the table <code>author_data</code> to be in the final output. Since there is no data for <code>author_id==3</code> in distinct_paper_year_count, the value of the <code>distinct_paper_year_count</code> column should be zero in the final result (for <code>author_id==3</code>).</p>
  
  <p>By using merge I am getting</p>
  
  <pre><code>   merge(distinct_paper_year_data,author_data,by="author_id") 
  
  author_id    distinct_paper_year_count paper_id confirmed
       1                         3       25733         1
       2                         1       47276         1
       4                         1       12856         0
  </code></pre>
  
  <p>How can the desired output be attained?</p>