title: R: update a column value by checking other columns in the same row
body: <p>I have the following data frame in R, and I need to update the values in column <code>feat_4</code> to 1 if any of the other 3 feature columns (feat_1, feat_2, and feat_3) contains a 1:</p>
  
  <pre><code>Name  feat_1  feat_2  feat_3   feat_4
  Tom    0        0       0        0
  David  1        0       1        0
  Tim    0        1       0        0
  </code></pre>
  
  <p>I know I can do this by using a <code>for-loop</code> like this, but is there a more efficient/vectorized way of doing it? I could have more columns than what is being show above. Thank you for help!</p>
  
  <pre><code>for (row in 1:nrow(df)) {
    if (any(df[row,2:4] == 1)) {
       df$feat_4 = 1
    }
  }
  </code></pre>