title: How to conditionally replace values in r data frame using if/then statement
body: <p>I'd like to learn how to conditionally replace values in R data frame using if/then statements. Suppose I have a data frame like this one:</p>
  
  <pre><code>df &lt;- data.frame(
  customer_id = c(568468,568468,568468,485342,847295,847295),
  customer = c('paramount','paramount','paramount','miramax','pixar','pixar'));
  </code></pre>
  
  <p>I'd like to do something along the lines of,
  "if customer in ('paramount','pixar') make customer_id 99. Else do nothing". I'm using this code, but it's not working:</p>
  
  <pre><code>if(df$customer %in% c('paramount','pixar')){
  df$customer_id == 99
  }else{
  df$customer_id == df$customer_id
  }
  </code></pre>
  
  <p>I get a warning message such as the condition has length > 1 and only the first element will be used. And the values aren't replaced.</p>
  
  <p>I'd also like to know how to do this using logical operators to perform something like,
  "if customer_id >= 500000, replace customer with 'fox'. Else, do nothing. </p>
  
  <p>Very easy to do in SQL, but can't seem to figure it out in R. </p>
  
  <p>My sense is that I'm missing a bracket somewhere?</p>
  
  <p>How do I conditionally replace values in R data frame using if/then statements?</p>