Check out example codes for "R vector all but last". It will help you in understanding the concepts better.

Code Example 1

y <- x[1:(length(x) - 1)]

Learn ReactJs, React Native from akashmittal.com