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

Bug: Setting a column of a dt inside a listcolumn of a dt fails #3474

Closed
jakob-r opened this issue Mar 27, 2019 · 1 comment · Fixed by #3584
Closed

Bug: Setting a column of a dt inside a listcolumn of a dt fails #3474

jakob-r opened this issue Mar 27, 2019 · 1 comment · Fixed by #3584
Milestone

Comments

@jakob-r
Copy link

@jakob-r jakob-r commented Mar 27, 2019

Setting a column of a data table inside a listcolumn of a data tabke fails if the outer data.table has only one row:

inner = data.table(a = 1:3, b = 1:3)
outer = data.table(aa = 1, ab = list(inner))
outer$ab[[1]]$b = 3L
Warning message:
In `[<-.data.table`(x, j = name, value = value) :
  Supplied 2 items to be assigned to 1 items of column 'ab' (1 unused)
outer$ab
[[1]]
 [1]  1  2  3

However the following works as expected:

outer$ab[[1]][, b := 3L]
outer$ab
[[1]]
       a     b
   <int> <int>
1:     1     3
2:     2     3
3:     3     3

Note that this bug only seems to occur if the outer data.table has just one row.

@jangorecki
Copy link
Member

@jangorecki jangorecki commented Mar 27, 2019

Thanks for reporting, note that behaviour of your code slightly changed in current development version, but issue is still valid. If you are not reporting on recent devel it is always useful to include sessionInfo() output.

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.

3 participants