Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
arunsrinivasan opened this issue Jun 8, 2014 · 0 comments
Assignees
Labels
Milestone

Comments

@arunsrinivasan
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant