Skip to content

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

@jakob-r

Description

@jakob-r

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions