x[i, j, by=.] where `i` is a data.table and `j` contains expressions from `i` should/could work as well

Đang mở
#733 29 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
r
Lĩnh vực
data

Hướng nghiên cứu

Start by running the two R examples in the issue and compare the join-and-grouping result with the explicitly chained form. Trace the data.table join and j/by evaluation paths to understand where expressions from the joined table are resolved; done means the valb case behaves equivalently without breaking the existing vala example.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

feature request joins

Referring to this SO post from @juancentro:

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

# (1)
dta[dtb, sum(vala), by=fidx]
#    fidx V1
#1:    a  4
#2:   NA NA

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

It would be nice to have case (2) returning the right result as well.

That is, as @juancentro and @eantonya mentioned:

dta[dtb, sum(valb), by=fidx] == dta[dtb][, sum(valb), by=fidx]

would be great!

Thanks to @juancentro for reporting on SO.

Ngôn ngữ chính
R
Star
3.9k
Fork
1.1k
Merge trung bình
14 giờ 4 phút
Pull request đã merge (30 ngày)
4

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Rdatatable/data.table

Tất cả issue của Rdatatable/data.table

Issue tương tự

Thêm issue về R

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.