title: What is difference between subset function and filter function in R?
body: <p>When I do these two functions in R, one returns error, but one works well. Why? I think both functions return same thing.</p>
  
  <pre><code>impute[1,]$steps &lt;- filter(steps_per_interval,
                             interval==impute[1,]$interval)[,2]
  </code></pre>
  
  <blockquote>
    <p>Error: invalid subscript type 'integer'</p>
  </blockquote>
  
  <pre><code>impute[1,]$steps &lt;- subset(steps_per_interval, 
                             interval==impute[1,]$interval)[,2]
  </code></pre>