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

split.data.table does not preserve attributes #2047

Closed
caneff opened this issue Mar 1, 2017 · 2 comments
Closed

split.data.table does not preserve attributes #2047

caneff opened this issue Mar 1, 2017 · 2 comments
Assignees
Milestone

Comments

@caneff
Copy link

@caneff caneff commented Mar 1, 2017

data.table 1.10.5, R 3.2.2.

split.data.frame preserves attributes from the original, but split.data.table drops them.

library(data.table)
dt=data.table(x=1:10)
setattr(dt, "a", 5)
attr(split(dt,rep(1:2,each=5))[[1]],"a")
# NULL (expect 5)
attr(split.data.frame(dt,rep(1:2,each=5))[[1]],"a")
# 5
@jangorecki jangorecki self-assigned this Mar 2, 2017
@jangorecki
Copy link
Member

@jangorecki jangorecki commented Aug 14, 2017

This should automatically works once #995 will be resolved.

@jangorecki
Copy link
Member

@jangorecki jangorecki commented Dec 15, 2018

Recent changes made by Matt in 3937881 solved this issue

library(data.table)
dt=data.table(x=1:10)
setattr(dt, "a", 5)
attr(split(dt,rep(1:2,each=5))[[1]],"a")
#[1] 5
attr(split.data.frame(dt,rep(1:2,each=5))[[1]],"a")
#[1] 5

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

Successfully merging a pull request may close this issue.

None yet
2 participants