I have been looking to your posts talking about te replacement of a value of a column with one of a second column base on conditions, but they were no working.
I will try to simplify the two data frame I have:
> paircomparison
V1 V2 V3 V4
A1 A1 A2 A2
A1 A1 A3 A3
A1 A1 A4 A4
A2 A2 A1 A1
A2 A2 A3 A3
A2 A2 A4 A4
A3 A3 A1 A1
A3 A3 A2 A2
A3 A3 A4 A4
A4 A4 A1 A1
A4 A4 A2 A2
A4 A4 A3 A3
>Ids
V1 V2
A1 London
A2 Roma
A3 Paris
A4 New York
I wanted to replace each time the value in paircomparison[,1:4] == the values in Ids$V1 with the value of Ids$V2.
I have been trying the following for loop:
for (x in paircomparison[,1:4]){
if (x == Ids[,1]){
x <- Ids[,2])}
}
but it is not working. I'm pretty new with R script and most probably I'm missing some steps in the script.