title: Replace field values if value in list
body: <p>This is not a major issue, but something that annoys me.</p>
  
  <p>in R I change the value of a field in one column, depending on the value of another column:</p>
  
  <pre><code>my_df[my_df$column1 == "ONE", 'column2'] &lt;- "My text"
  my_df[my_df$column1 == "TWO", 'column2'] &lt;- "My text"
  </code></pre>
  
  <p>and so on</p>
  
  <p>If I try to shorten to one line by adding:</p>
  
  <pre><code>my_df[my_df$column1 == c("ONE", "TWO"), 'column2'] &lt;- "My text"
  </code></pre>
  
  <p>I get a warning message:
  "longer object length is not a multiple of shorter object length"</p>
  
  <p>Is there an obvious way to do this without repeating the same line over and over?</p>
  
  <p>Thanks for your help as always</p>