R: How to get the last element from each group?

后端 未结 1 546
日久生厌
日久生厌 2020-12-12 02:49

I have a data frame containing a time series with two time stamp columns, d$day and d$time, and say, for simplicity, one measured variable d$

相关标签:
1条回答
  • 2020-12-12 03:18

    Did you try this?

    val_eod <- aggregate(d$val1, by = list(d$day), FUN = tail, n = 1)
    
    0 讨论(0)
提交回复
热议问题