title: r - create function to calculate count of filtered rows in dataset
body: <p>I'm trying to create a helper function that will calculate how many rows are there in a data.frame according parameters.</p>
  
  <pre><code>getTotalParkeds &lt;- function(place, weekday, entry_hour){
    data &lt;- PARKEDS[
                    PARKEDS$place      == place,
                    PARKEDS$weekday    == weekday,
                    PARKEDS$entry_hour == entry_hour
                    ]
    return(nrow(data))
  }
  </code></pre>
  
  <p>Then I'm running this like:</p>
  
  <pre><code>getTotalParkeds('MyPlace', 'mon', 1)
  </code></pre>
  
  <p>So it is returning this error:</p>
  
  <pre><code>Warning: Error in : Length of logical index vector must be 1 or 11 (the number of columns), not 10000
  </code></pre>
  
  <p>I'm totally new to R, so I have no idea on what is happening.</p>