I have a dataset of 2,407 entries, 14 total columns, I called it rtpj. I am trying to add a column of numeric values called 'agent' to the dataset based on the values in my 'conditions' column. The 'conditions' column values are either 1st_P_harm, 1st_P_neut, 3rd_P_harm, 3rd_P_neut, comp_other, or comp_self. I would like to change them to numeric values of 1,2,3,4,5,6 respectively. I have tried
rtpj$conditions = as.numeric(rtpj$conditions)
and I get a warning about NAs. Sure enough, after I did this all the values in my 'conditions' column turned to NA, which makes sense since I haven't assigned any of the 6 possible conditions to a numeric value. How do I do this? I think I am missing some crucial step.