When trying to store a vector in a data.table, this works only when the data.table has length of more than one.
Please find below a simplified version of the problem
library(data.table)
dt <- data.table( a = c("a", "b"), l = list())
dt$l[[1]] <- c(1:3)
a l
1: a 1,2,3
2: b
dt <- data.table( a = c("a"), l = list())
dt$l[[1]] <- c(1:3)
Error in [<-.data.table(x, j = name, value = value) : Supplied 3 items to be assigned to 1 items of column 'l'. The RHS length must either be 1 (single values are ok) or match the LHS length exactly. If you wish to 'recycle' the RHS please use rep() explicitly to make this intent clear to readers of your code.
a l
1: a 1,2,3
Is this what you're looking for?
dt <- data.table(a = "a", l = list())
dt[1L, l := list(list((1:3)))]
Results in:
a l
1: a 1,2,3