samedi 3 octobre 2015

Check Values to see if they fall in interval

I am trying to check values to see if they fall into the interval below

   if((First$Height>=10 & First$Height<=50)==TRUE) {
      cat("No errors \n")
   } else {
      cat("Error \n")
   }

But when I run this first line, i get:

the condition has length > 1 and only the first element will be used

I have tried many different combinations of the above statement and every time I get this error. I also tried using &&. While I didn't get an error, it did not give me the correct output I am looking for. I am wondering why I keep getting this error for my statement, I cannot figure it out. Is there a way for me to adjust my statement so that I won't get the error?

Aucun commentaire:

Enregistrer un commentaire