# NOT RUN {
# new DTSg object
x <- DTSg$new(values = flow)
# filter for the last six rows
## R6 method
x$subset(i = (.N - 5):.N)
## S3 method
subset(x = x, i = (.N - 5):.N)
# filter for the first two observations per year
## R6 method
x$subset(i = 1:2, funby = function(x, ...) {data.table::year(x)})
## S3 method
subset(x = x, i = 1:2, funby = function(x, ...) {data.table::year(x)})
# }
Run the code above in your browser using DataLab