title: Populating a column in R based on conditions from another column using a for loop and if statements
body: <p>I'm looking at populating a different column in my data frame (project_data$Outlier) based on conditions from another column using a for loop and if statements. I'm trying to find outliers in my data based on the crop type from a different column (Commodity) as well as if the Total_Yield value is at or below a certain value. However, I keep getting different errors every time I try to run my code which is in the below pic:</p>
  <p><a href="https://i.stack.imgur.com/jh7wS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jh7wS.png" alt="enter image description here" /></a></p>
  <p>Would someone be able to give me some guidance or a more accurate code script to utilize?</p>