title: Create a new value based on summing specific columns in R
body: <p>I have a dataframe:</p>
  <pre><code>dat &lt;- data.frame(col1 = sample(0:3, 10, replace = TRUE),
                    col2 = sample(0:3, 10, replace = TRUE),
                    col3 = sample(0:3, 10, replace = TRUE),
                    col4 = sample(0:3, 10, replace = TRUE))
  </code></pre>
  <p>I want to create a new vector (outside of the dataframe) <code>var</code> that will state <code>1</code> if the sum of <code>col3</code> and <code>col4</code> is &gt;= 4 and 0 otherwise. How can I do this? I tried using <code>sum</code> within an <code>ifelse</code> statement but it seems to produce a <code>character</code> output.</p>
  <p>Any leads? Thanks!</p>