Error when trying to store list in data.table of length 1
问题 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) Working fine dt <- data.table( a = c("a", "b"), l = list()) dt$l[[1]] <- c(1:3) Results in: a l 1: a 1,2,3 2: b Producing Error 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