title: Subsetting with square brackets while piping with dplyr functions
body: <p>While I have a (somewhat convoluted) work-around, I'm trying to figure out why subsetting with square brackets ([]) does not work the same when piping results from dplyr functions.</p>
  
  <p>For a really simple demonstration.  The first two work:</p>
  
  <pre><code>library(dplyr)
  
  my_data &lt;- mtcars %&gt;% 
    filter(qsec == 16.46)
  my_data[,"gear"]
  #[1] 4
  
  filter(mtcars, qsec == 16.46)[,"gear"]
  #[1] 4
  </code></pre>
  
  <p>However, the following fails:</p>
  
  <pre><code>mtcars %&gt;% filter(qsec == 16.46)[,"gear"]
  
  #Error in filter(qsec == 16.46) : object 'qsec' not found
  </code></pre>
  
  <p>I can't seem to find anything that will allow this notation to work. I can get around it by doing some things like:</p>
  
  <pre><code>mtcars %&gt;% 
    filter(qsec == 16.46) %&gt;% 
    select(gear) %&gt;% 
    as.numeric()
  #[1] 4
  
  mtcars %&gt;% 
    filter(qsec == 16.46) %&gt;% 
    subset(subset = TRUE, select = "gear") %&gt;% 
    as.numeric()
  #[1] 4
  </code></pre>
  
  <p>But that's adding minimum of two piped functions (depending on what you are needing to subset), and it seems like the square bracket notation <em>should</em> work, but does not, at least, not in the way I expect.</p>
  
  <p>Any insight on why <code>filter(mtcars, qsec == 16.46)[,"gear"]</code> works, 
  but <code>mtcars %&gt;% filter(qsec == 16.46)[,"gear"]</code> does not?</p>