Skip to content

[R-Forge #2392] Add length postfix to list column output #605

Closed

Description

@arunsrinivasan

Submitted by: Matt Dowle; Assigned to: Nobody; R-Forge link

Trailing comma is easily missed. Something like :

A B C
foo 1,2,3,4 42
bar 3,4,5,6,[12] 43

or put the postfix on all items for consistency.

Activity

  1. jangorecki commented on Apr 5, 2020

    @jangorecki
    Member

    It does work already but for a list elements inside a list column

    DT = data.table(A=c("foo","bar"), B=list(c(1,2,3,4), c(3,4,5,6,7,8,9,10,11,12)), C=c(42,43))
    DT
    #        A               B     C
    #   <char>          <list> <num>
    #1:    foo         1,2,3,4    42
    #2:    bar 3,4,5,6,7,8,...    43
    DT[, B := lapply(B, as.list)]
    DT
    #        A          B     C
    #   <char>     <list> <num>
    #1:    foo  <list[4]>    42
    #2:    bar <list[10]>    43

    Do we want to have length printed in the first case as well?
    Should the print of B be changed as well?

    #        B
    #    <list>
    #  <num[4]>
    # <num[10]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions