-2

I have a data frame with a column that is filled with string entries of {A,B,C}, but want to replace all entries of A with B. What function would be best to do this? Thanks, I'm still an R newbie!

Emna Ayadi
  • 2,430
  • 8
  • 37
  • 77
anthony
  • 1
  • 2
  • 2
    You should provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output to make it very clear exactly how your data is structured and what you need to accomplish. – MrFlick May 16 '16 at 18:33

1 Answers1

0

gsub allows you to pattern match replace values in a vector as in the following small example.

df = data.frame(sample(100,12), letters[1:3])
df[,2] = gsub("a","b",df[,2])
jamieRowen
  • 1,509
  • 9
  • 14