-
Notifications
You must be signed in to change notification settings - Fork 33
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
repr does not handle nested dataframes #71
Comments
tibble uses https://github.com/hadley/tibble/blob/7b7a0c15c527bae75676f7ba786914697bb78b11/R/type-sum.r for the short summeries of nested objects |
what is a “nested data frame”? a_data_frame <- structure(
list(Foo = 1:3, Bar = letters[1:3]),
class = 'data.frame',
row.names = paste0('R', 1:3)) so there’s no way to “nest” them. whatever your libraries do there isn’t returning a |
This is not true. It's quite easy to create nested data.frame structures DF = data.frame(a=1:10)
DF$l = as.list(DF$a)
DF$nested = data.frame(b = 10:1, c = letters[1:10])
DF$mat = as.matrix(DF$nested)
DF
# a l nested.b nested.c mat.b mat.c
# 1 1 1 10 a 10 a
# 2 2 2 9 b 9 b
# 3 3 3 8 c 8 c
# 4 4 4 7 d 7 d
# 5 5 5 6 e 6 e
# 6 6 6 5 f 5 f
# 7 7 7 4 g 4 g
# 8 8 8 3 h 3 h
# 9 9 9 2 i 2 i
# 10 10 10 1 j 1 j |
And in
|
hm, tidyverse thinks differently about nesting data.frames, but of course repr’s code shouldn’t crash when trying to render either of them. PRs welcome! |
One solution could be to add a
if df contains a nested df/list/... column, refuse to rich print with a warning...
[I'm not sure if data.frames are allowed to contain nested data-frames, but I do have such a data.frame here coming from a JSON structure:
]
The text was updated successfully, but these errors were encountered: