I am new to R programming and I have imported a CSV file. I would like to change the variable value for symbol column. If the value is "DEF" then "NEW1". If the value is "GHI" then "NEW2". I tried the below code but, I am getting a warning message and I checked the dataframe contains "NA" after changing.
df$symbol[df$symbol == "DEF"] <- "NEW1"
df$symbol[df$symbol == "GHI"] <- "NEW2"
Warning message:
In `[<-.factor`(`*tmp*`, df$symbol == "DEF", :
invalid factor level, NA generated