Im trying to assign the value of -1, to every number in my vector that is inbetween 2 and 5. I thought an if - then statement would work. I am having some trouble. I dont think (2
x <- c(3.2,6,7.8,1,3,2.5)
if (2<x<5){
cat(-1)
} else {
cat (x)
}
See Question&Answers more detail:os