I am trying to find a quick way to replace the values (strings) in several columns of a dataframe.
id = c(2, 3, 5)
v1 = c("aa", "bb", "cc")
v2 = c("ee", "aa", "cc")
df = data.frame(id,v1,v2)
print(df)
id v1 v2
1 2 aa ee
2 3 bb aa
3 5 cc cc
What I want is to replace all instances of "aa" by "uu" and of "cc" by "rr"
id v1 v2
1 2 uu ee
2 3 bb uu
3 5 rr rr