You are using elements.slice(R3,1) wrong. Second argument means not the length of the array you want to get, but the zero-based index of the element when slice method should stop. So your code is saying “Give me elements from index R3 till index 1”, and the only one time when it will work: elements.slice(0, 1).
If you just need to get one element – use elements[R1]. If you need to get array with one element you can keep using slice with elements.slice(R1, R1 + 1);