r - First element in a data.table aggregation -


i have data.table of tick data, want aggregate seconds timeframe. while getting max, min , last pretty straightforward:

data[, list(max(value), min(value), last(value)), by=time] 

i struggling first datapoint corresponds second timestamp. there nothing in manual. there easy way it, say, sql top?

i managed find solution. query first element subset column's first value using [:

data[, list(value[1], max(value), min(value), last(value)),by=time] 

maybe helps someone.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -