jeudi 22 mars 2018

How can I check the list of numbers are in the range or not

I would like to validate the list of numbers are in the range or not.

if the list of numbers are smaller than 33 and bigger than 38, I want those numbers to be returned with their order.

i<-c(33,34,35,36,37,38,80,100)
for (i in 1:length(i)) {
  if ( 33 < i & i < 38 ) {
   next
  }
  print(i)
}

but it returns everything even though it shouldn't be

Aucun commentaire:

Enregistrer un commentaire