#RStats Truth:

Nested data.frames which are *not* in list-columns are an abomination!

> df1 <- data.frame(x = 1:2)
> df2 <- data.frame(y = c('a', 'b'), z = c(1.1, 2.2))
> df1$nest <- df2

> names(df1)
[1] "x" "nest"

> df1
x nest.y nest.z
1 1 a 1.1
2 2 b 2.2
>

@coolbutuseless preach

But also, {jsonlite} reads in .json that way 😬

Not sure there's a better way to read in .json files.

@ryanmcshane @coolbutuseless … not guess the format, and preserve all objects as lists (unless the user explicitly specifies a fixed deserialisation format). Auto-guessing as the default is an antipattern.

@klmr @coolbutuseless aren't all data.frames lists? Just lists composed of vectors of equal length? Not sure of the disadvantage of having something as a data.frame column instead of a list column (temporarily!).

Between tidyr::unpack, purrr::unnest, purrr::pluck, and tidyr::hoist, there's something to handle every situation to reach a rectangled data.frame anyway (?)

@ryanmcshane @coolbutuseless The issue in this case is that lists in the JSON get deserialised as vectors, not unnamed lists, so you lose type information (scalars vs lists of length one), so you can’t losslessly round-trip your data.
@ryanmcshane data.frames are lists but not lists of lists :)