mardi 9 mars 2021

Populating a column in R based on conditions from another column using a for loop and if statements

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:

Code Pic

Would someone be able to give me some guidance or a more accurate code script to utilize?

Aucun commentaire:

Enregistrer un commentaire