Submitted by: Garrett See; Assigned to: Nobody; [R-Forge link](https://r-forge.r-project.org/tracker/index.php?func=detail&aid=5191&group_id=240&atid=975) Note that in the output below the values in `V1` are only 6 digits long ``` S library(data.table) dat <- data.table(Date=c(20131101:20131130, 20131201:20131231)) dat[, last(Date), by=Date %/% 100L] # Date V1 #1: 201311 201311 #2: 201312 201312 ``` I thought it should give the same results as this: ``` S dat[, last(Date), by=substr(Date, 1, 6)] # substr V1 #1: 201311 20131130 #2: 201312 20131231 ```