R: removing the last elements of a vector

后端 未结 6 1320
梦如初夏
梦如初夏 2021-01-31 07:36

How can I remove the last 100 elements of a zoo series?

I know the name[-element] notation but I can\'t get it work to substract a full section

6条回答
  •  野性不改
    2021-01-31 08:14

    I like using head for this because it's easier to type. The other methods probably execute faster though... but I'm lazy and my computer is not. ;-)

    x <- head(x,-100)
    > head(1:102,-100)
    [1] 1 2
    

提交回复
热议问题