title: Is there more efficient way to check the number of cases in every brach in variable?
body: <p>For 100 000 000 rows it costs 5 sec. It is too much. Do ya know how to improve this code to get the checking faster?</p>
  
  <pre><code> #a variable to check
  xVar &lt;- as.factor(sample(x=c("transp","bud","wolny","pref",
                                        "inny"), size=100000000, replace=T))
  
  #a trigger, if a variable has less then 1000 number of cases in any branch then the variable warn will fill with a comunicat
  sen &lt;- 10000 
  
  #function to improve
  check &lt;- function(xVar, sen){
    if (min(table(xVar)) &lt; sen){
      warn &lt;- "Variable has very low number in some branches - IV can be spoiled"
    }else{
      warn &lt;- ""
    }
  }
  
  #go
  start &lt;- Sys.time()
  check(xVar, sen)
  stop &lt;- Sys.time()
  stop - start
  </code></pre>