I have a data frame that contains three types AA, AB and BB. After that, there are samples 1000 to 1005 which contains different types. However, some of the strings are type BA not like the type 2 AB, therefore I want to change the strings to match the type 2 category.
Input:
Type 1 Type 2 Type 3 1000 1001 1002 1003 1004 1005
AA AB BB BB BB AB BA AA BA
CC AC AA CA CA CC AA AA AC
EE EF FF EF FF FE FE EE FF
Desired output:
Type 1 Type 2 Type 3 1000 1001 1002 1003 1004 1005
AA AB BB BB BB AB AB AA AB
CC AC AA AC AC CC AA AA AC
EE EF FF EF FF EF EF EE FF
mydata[ mydata == "BA" ] <- "AB"?