How to access the last value in a vector?

后端 未结 11 1260
栀梦
栀梦 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:32

    Package data.table includes last function

    library(data.table)
    last(c(1:10))
    # [1] 10
    

提交回复
热议问题