dplyr: filter based on another column
<p>Let's say that I have the following data and am interested in grabbing data by date where the type is "ts". Of course, there are dates where ts is not available, and I need to revert to the 'real' values for those dates.</p>

<pre><code>dat = data.frame(dte = c("2011-01-01","2011-02-01","2011-03-01","2011-04-01","2011-05-01",
                         "2011-01-01","2011-02-01","2011-03-01"),
                 type = c("real","real","real","real","real","ts","ts","ts"),
                 value=rnorm(8))
dat

cpy = dat %&gt;% dplyr::filter(type == "ts") 

cpy
</code></pre>

<p>How can something like that be done in dplyr.</p>

<p>Expected output is:</p>

<pre><code>dte            type    value
"2011-01-01"   ts      ....
"2011-02-01"   ts
"2011-03-01"   ts  
"2011-04-01"   real
"2011-05-01"   real
</code></pre>