colearendt / tidyjson

Tidy your JSON data in R with tidyjson
Other
182 stars 15 forks source link

Create a json_nested function to identify which documents contain nested arrays #84

Open jeremystan opened 8 years ago

jeremystan commented 8 years ago

Should create a new column, "nested.array", which identifies which rows have nested arrays.

Should be somewhat similar to this, but not get tripped up on strictly nested objects. Goal is to find the structures that cannot be simply expanded using spread_all.

companies %>% gather_object %>% json_types %>% json_complexity %>% filter(complexity > 1) %>% count(name, type)

#> Source: local data frame [16 x 3]
#> Groups: name [?]
#> 
#>              name   type     n
#>             <chr> <fctr> <int>
#> 1     acquisition object   149
#> 2    acquisitions  array    84
#> 3    competitions  array   221
#> 4  external_links  array   214
#> 5  funding_rounds  array   322
#> ...