title: Summing over a range of value in R (not using for loop)
body: <p>How do you perform such summation in R?</p>
  
  <pre><code>sum_{i=1}^3 (x^2)
  
  i=1 is lower bound
  i=3 is upper bound
  x^2 is the operation
  </code></pre>
  
  <p>So we will perform</p>
  
  <p>1^2 + 2^2 + 3^2</p>
  
  <p>Using standard loop:</p>
  
  <pre><code>tot &lt;-0
  for (x in 1:3) {
    tot &lt;- tot + x^2
  }
  </code></pre>