I would like to replace names in my database with names i have in a list without having to write all the different names manually.
I have 56 different chemical names in a df with 2 columns, 1 column is the "Wrong" name and 1 column is the "Correct" names.
My Database dataframe has 2500 different Measurement of these different parametres and i need to change the names of the parametres.
So instead of this:
Database$Parametre <- with(Database, ifelse(Parametre == "Quicksilver", "Hg", ifelse(Parametre == "Arsenic", "As", ifelse(Parametre == "Lead", "Pb".... and so on for 50 chemicals.
I would like to change the name of the parametres according to my chemnames df.
Database$Parametre <- with(Database, ifelse(Parametre == ChemNames$Wrong,ChemNames$Corret, as.character(Parametre)))
But his gives me an error saying levels for the factors a different.
Hope this is understandable and hope you can help.