R: removing the last elements of a vector

后端 未结 6 1319
梦如初夏
梦如初夏 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:07

    Just use the numeric indices, ie

     N <- nrow(X)
     X <- X[1:(N-100-1),]
    

    where you should need to ensure N is larger 100 etc

提交回复
热议问题