R array manipulation

后端 未结 2 1493
梦毁少年i
梦毁少年i 2021-02-19 16:40

In python lists can be sliced like this x[4:-1] to get from the fourth to the last element.

In R something similar can be accomplished for vectors with

2条回答
  •  一个人的身影
    2021-02-19 17:33

    In case you are interested in slicing the last n elements of the array then you could use:

    x[seq(length=n, from=length(x), by=-1)] 
    

提交回复
热议问题