-1

I have two sets of Data frames. One contains the region names for different regional code. Another data frames has certain GTU data's with regional code mentioned. I want to replace regional codes of second data with region names based on the 1st data Using R. Please help !

  • sounds like a join? also, please provide a Minimal Working Example (https://stackoverflow.com/help/mcve) . Tips here: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – friep Jul 07 '17 at 10:38

1 Answers1

0

If your data.frames are called df1 and df2 then you could try

try df_final <- merge(df1,df2,by="regional code").

Then df_final will contain everything (also region names and regional code).

Later you can delete the regional code column if you want by using

df_final[, !(colnames(df_final) %in% c("regional code"))]

quant
  • 4,062
  • 5
  • 29
  • 70