Skip to content

Failed to extract grouped list values #4761

@hongyuanjia

Description

@hongyuanjia

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

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