Related to ARROW-8813 ARROW-12099
The arrow package can convert json files to data frames very easily, but tidyr::unnest_longer is needed for array expansion.
Wonder if tidyr could be added to the recommended package and examples like this could be included in the documentation and test cases.
tf <- tempfile()
on.exit(unlink(tf))
writeLines('
{ "hello": 3.5, "world": false, "foo": { "bar": [ 1, 2 ] } }
{ "hello": 3.25, "world": null }
{ "hello": 0.0, "world": true, "foo": { "bar": [ 3, 4, 5 ] } }
', tf)
arrow::read_json_arrow(tf) |>
tidyr::unnest(foo, names_sep = ".") |>
tidyr::unnest_longer(foo.bar)
#> # A tibble: 6 × 3
#> hello world foo.bar
#> <dbl> <lgl> <int>
#> 1 3.5 FALSE 1
#> 2 3.5 FALSE 2
#> 3 3.25 NA NA
#> 4 0 TRUE 3
#> 5 0 TRUE 4
#> 6 0 TRUE 5
Reporter: SHIMA Tatsuya / @eitsupi
Note: This issue was originally created as ARROW-17143. Please see the migration documentation for further details.
Related to ARROW-8813 ARROW-12099
The arrow package can convert json files to data frames very easily, but
tidyr::unnest_longeris needed for array expansion.Wonder if
tidyrcould be added to the recommended package and examples like this could be included in the documentation and test cases.Reporter: SHIMA Tatsuya / @eitsupi
Note: This issue was originally created as ARROW-17143. Please see the migration documentation for further details.