title: ifelse in a mutate function in r
body: <p>I am trying to add a column with a condition using the mutate function in r, but keep getting an error. The code is straight from the teacher's lecture, but yet an error occurs. The LineItem column is a factor class, I am not sure if that make a difference.
  Please advice on what I am missing.</p>
  
  <p>Thank you,
  Avi</p>
  
  <pre><code>df &lt;- read.csv('ities_short.csv')
  
  colSums(is.na(df))
  
  sl &lt;- str_length(df$LineItem)
  avg &lt;- mean(str_length(df$LineItem))
  
  df &lt;- df %&gt;% mutate(LineItem_LongName = ifelse(sl &gt; avg), 1, 0)
  </code></pre>
  
  <p>Error in ifelse(sl > avg) : argument "yes" is missing, with no default</p>