How to access the last value in a vector?

后端 未结 11 1259
栀梦
栀梦 2020-11-28 18:05

Suppose I have a vector that is nested in a dataframe one or two levels. Is there a quick and dirty way to access the last value, without using the length() fu

11条回答
  •  情歌与酒
    2020-11-28 18:19

    The xts package provides a last function:

    library(xts)
    a <- 1:100
    last(a)
    [1] 100
    

提交回复
热议问题