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)
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.
Setting a column of a data table inside a listcolumn of a data tabke fails if the outer data.table has only one row:
However the following works as expected:
Note that this bug only seems to occur if the outer data.table has just one row.