Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arunsrinivasan opened this issue Jun 8, 2014 · 1 comment
Open

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

arunsrinivasan opened this issue Jun 8, 2014 · 1 comment

Comments

@arunsrinivasan
Copy link
Member

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.

@jangorecki
Copy link
Member

jangorecki commented Apr 5, 2020

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
Projects
None yet
Development

No branches or pull requests

2 participants