How do I write an if statement that stops code when any variable in the vector is outside of the intended sequence?
y <- c(1,2,3,4,11)
if(y > 10 | y < 0)
stop("Score has to be between 0 and 10")
Would it be done through loops? If so, which loop?