title: How to join a data frame to itself within a dplyr chain?
body: <p>Occasionally, I need to join a data frame to (usually a modified) version of itself within a dplyr chain. Something like this:</p>
  
  <pre><code>df  &lt;- data.frame(
       id = c(1,2,3)
     , status = c('foo','bar','meh')
     , spouseid = c(4,3,2)
  )
  
  
  df %&gt;% 
    filter( status == 'foo' | status == 'bar') %&gt;% 
    # join the filtered table to itself using the dot as the right-hand side
    left_join(., by = c('id' = 'spouseid'))
  </code></pre>
  
  <p>When I try that, I get <code>Error in is.data.frame(y) : argument "y" is missing, with no default</code>. </p>