I have a data frame in R, called arcs
, that has some values of which I would like to change the name.
I would like to change the name based on another data frame, called data2
.
data2
has two columns, the first column is the old name, and the second column is the new name.
I would like to go through arcs
and if there is a name in arcs
that appears in the first column of data2
, I would like to change it to the second column of data2
.
Is that possible?
For example, if this was arcs
data 1 blah 1
blah 2 data 2
blah 3 data 3
blah 4 blah 5
data 4 data 5
and this was data2
data 1 real 1
data 2 real 2
data 3 real 3
data 4 real 4
data 5 real 5
I would want the new arcs to look like this:
real 1 blah 1
blah 2 real 2
blah 3 real 3
blah 4 blah 5
real 4 real 5