title: Recursion function in R
body: <p>Here is the code, that calculate the binomial coefficient:</p>
  
  <pre><code>binomial_coef &lt;- function(n,r){
      if (n == r | r == 0){
          return(1)
      }
      else{
          result &lt;- binomial_coef(n-1,r-1) + binomial_coef(n-1,r)
          return(result)
      }
  }
  </code></pre>
  
  <p>Can you please explain how this code works? How can it calculate, when the function(binomial_coef) isn't define(I mean, there is no formula inside the code)</p>
  
  <p>Thanks</p>