title: simple if else statement in syntax error in R
body: <p>I would like to R to the following:
  if LocID is equal to 3,4,7,8, 14 then data$newConc is equal to data$conc/2
  else data$newConc &lt;- data$conc   # else keep conc the same</p>
  
  <pre><code>data$newConc &lt;- if(data$LocID == c(3,4,7,8,14))
  data$conc/2 else data$conc
  
  str(data)
   $ LocID     : int  1 2 3 4 5 6 7 8 9 10 ...
   $ time      : int  1 1 1 1 1 1 1 1 1 1 ...
  $ conc      : num  0.03695 0.0155 0.00738 0.00753 0.01795 ...
  </code></pre>
  
  <p>Warning:
    the condition has length > 1 and only the first element will be used</p>