How to replace levels with certain value?
I could be able to achieve this with the following code:

testing$var1 &lt;- as.character(testing$var1)
a &lt;- data.frame(a)
testing$var1 [testing$var1 %in% a[1,] &lt;- "Others"
testing$var1 &lt;- as.factor(testing$var1)


In case if there is any other better/effective solution/function to achieve this, please let me know. 

Thanks all.