I have a data frame with different areas. The naming of the areas has changed in the last year, so I would like to change to the old names. I have a list of the names as in the DataSet and how I want them to be, witch looks like:
> A <- c("Agri & Forestry", "Econs & Econometrics")
> B <- c("Agriculture", "Economics & Econometrics")
> cbind(A, B)
A B
[1,] "Agri & Forestry" "Agriculture"
[2,] "Econs & Econometrics" "Economics & Econometrics"
For instance, I don't want "Agriculture" I want "Agri & Forestry".
My list has around 30 different changes. It's possible to open this list on R and make this change? My DF looks like that:
> year <- c(2018, 2018, 2019,2020,2021,2021)
> area <- c("Agri & Forestry", "Agri & Forestry", "Econs & Econometrics",
+ "Econs & Econometrics", "Agriculture", "Economics & Econometrics")
> cbind(year, area)
year area
[1,] "2018" "Agri & Forestry"
[2,] "2018" "Agri & Forestry"
[3,] "2019" "Econs & Econometrics"
[4,] "2020" "Econs & Econometrics"
[5,] "2021" "Agriculture"
[6,] "2021" "Economics & Econometrics"
And I want something like:
> area2 <- c("Agri & Forestry", "Agri & Forestry", "Econs & Econometrics",
+ "Econs & Econometrics", "Agri & Forestry", "Econs & Econometrics")
> cbind(year, area2)
year area2
[1,] "2018" "Agri & Forestry"
[2,] "2018" "Agri & Forestry"
[3,] "2019" "Econs & Econometrics"
[4,] "2020" "Econs & Econometrics"
[5,] "2021" "Agri & Forestry"
[6,] "2021" "Econs & Econometrics"