Skip to content

[R-Forge #5191] Some operations in by= are applied to data.table before j is evaluated #497

@arunsrinivasan

Description

@arunsrinivasan

Submitted by: Garrett See; Assigned to: Nobody; R-Forge link

Note that in the output below the values in V1 are only 6 digits long

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:

dat[, last(Date), by=substr(Date, 1, 6)]
#    substr       V1
#1: 201311 20131130
#2: 201312 20131231

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions