this is my first time using a if-else statement in R. I have a column (in a data frame) named 'Performance' that has percentages (some of which are estimates). I have created a new column named 'Estimate' which takes the last character of the 'Performance' column. Now, I want to make a column with the following conditions: If 'Estimate' = '*' then 'Estimate' = 'YES' else 'Estimate' = 'NO'. I just want to keep the new column name 'Estimate'. The statement I have written works, but I am getting an error message that says:
"Warning message: In if (data.set$Estimate == "*") { : the condition has length > 1 and only the first element will be used"
Here is my statement:
data.set$Estimate <- if (data.set$Estimate == '*') {data.set$Estimate = 'YES'} else{data.set$Estimate = 'NO'}
Can someone please explain why I am getting this error message, and/or what I would need to change to not get it? Any help is much appreciated.