title: How do I use condition with rows in a dataframe (weighted average, R language)?
body: <p>I  need to calculate the weighted average of each row in the dataframe, where:
  Does anyone know how to do it using the R language?
  regards</p>
  
  <pre><code>t1 &lt;- c(1, 2, 4, 6, 7, 9)
  t2 &lt;- c(6, 6, 5, 3, 3, 7)
  df &lt;- data.frame(t1 = t1, t2=t2, stringsAsFactors = FALSE)
  
  if value &lt;= 5 , weight is 1
  if value &gt; 5 and &lt;= 8 , weight is 2
  if value &gt; 8 , weight is 3
  </code></pre>