vendredi 7 août 2020

If, else statement issue in r [closed]

I am trying to filter and label three categories: "High", "Low", and "Other" based on two columns, "Metering" and "Taskload".

Here is my code:

WorkloadCategory <- function(Metering, Taskload) 
  if(Metering == "7"/"M" & (Taskload > median_taskload) 
   print("High")
  if(Metering == "1"/"3" & (Taskload < median_taskload)
   print("Low")
  if_else  
   print("Other")

I am having some difficulty doing this as the "If else" statement isn't working. All the other statements are working. When I add } to my code, it pulls up an error message and says "unexpected symbol: }"

Any suggestions would be so helpful!! Thank you so much

Aucun commentaire:

Enregistrer un commentaire