How can I completely replace categorical values with self-assigned numerical values in a whole dataframe? r : <p>I have a data frame with the only the categorical values "Agree", "Disagree" and "Not Certain". I just want to replace "Agree" with the numerical value 2, "Disagree" with 1 and "Not certain" with 0.5, so that I can add them and get a score.</p>

<p>I found that mapvalues only applies to factors and vectors and I don't know how to use as.numeric so that I can specify which values should be assigned to the categorical variables. 
Additionally, I cannot actually replace the values in the dataframe, it just creates a new value named like the data frame with the three numbers in it.</p>
