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

shortcut prefix x. and i. for variables in joins in 1.9.3 #732

Closed
arunsrinivasan opened this issue Jul 14, 2014 · 2 comments · Fixed by #2945
Closed

shortcut prefix x. and i. for variables in joins in 1.9.3 #732

arunsrinivasan opened this issue Jul 14, 2014 · 2 comments · Fixed by #2945

Comments

@arunsrinivasan
Copy link
Member

In 1.9.3, there should be ways to access x's key columns in j directly (and i's key columns as well) using the shortcut prefix x. and i..

dta <- data.table(idx=1:3, vala=4:6, key="idx")
dtb <- data.table(idx=c(1,4), valb=c(10,11), key="idx")

# (1)
dta[dtb, list(idx, sum(valb)), by=.EACHI]
#   idx idx V2
#1:   1   1 10
#2:   4  NA 11

# (2)
dta[dtb, list(x.idx, sum(valb)), by=.EACHI]
# Error in `[.data.table`(dta, dtb, list(x.idx, sum(valb)), by = .EACHI) : 
#   object 'x.idx' not found

(2) should return:

# x.idx V2
#     1 10
#    NA 11

PS: Note that there's already a related issue #471 on (1) regarding names of data.table join in 1.9.3.

@arunsrinivasan arunsrinivasan changed the title joins in 1.9.3 shortcut prefix x. and i. for variables in joins in 1.9.3 Jul 14, 2014
@arunsrinivasan arunsrinivasan modified the milestone: v1.9.4 Jul 15, 2014
@jangorecki
Copy link
Member

This was resolved by @arunsrinivasan in 620276b

@jangorecki
Copy link
Member

not yet works with .EACHI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants