Related to #4758 and hongyuanjia/eplusr#346
# Current GitHub version
dt <- data.table(
value = as.list(1:6),
index = rep(1:2, each = 3)
)
dt[, by = "index", list(value = list(value))]$value
# [[1]]
# [[1]][[1]]
# [1] 4
#
# [[1]][[2]]
# [1] 5
#
# [[1]][[3]]
# [1] 6
#
#
# [[2]]
# [[2]][[1]]
# [1] 4
#
# [[2]][[2]]
# [1] 5
#
# [[2]][[3]]
# [1] 6
# Current CRAN version
dt <- data.table::data.table(
value = as.list(1:6),
index = rep(1:2, each = 3)
)
dt[, by = "index", list(value = list(value))]$value
# [[1]]
# [[1]][[1]]
# [1] 1
#
# [[1]][[2]]
# [1] 2
#
# [[1]][[3]]
# [1] 3
#
#
# [[2]]
# [[2]][[1]]
# [1] 4
#
# [[2]][[2]]
# [1] 5
#
# [[2]][[3]]
# [1] 6
Related to #4758 and hongyuanjia/eplusr#346