-2

I have a vector, A, with lots of entries, for example

1 4 2 5 6 7 8 3 5

I want to get a list of all the positions of entries in that vector that are in [2,6], so id like the output to be

2 3 4 5 8 9

please help

acf312
  • 19

1 Answers1

1

We can use %in%

which(v1 %in% 2:6)
akrun
  • 874,273
  • 37
  • 540
  • 662