 <p>You can use the <code>mapvalues</code> function from the <code>plyr</code> package. Try this code snippet, which assumes that you have a factor column in a data frame called <code>df$column</code>:</p> <pre><code>library(plyr) vals_to_replace &lt;- c("diet", "diet contr", "IDDM") mapvalues(df$column, from = vals_to_replace, to = rep("No", length(vals_to_replace))) </code></pre> <p>You can add as many factor names to <code>vals_to_replace</code> as you like.</p>