block by timelyportfolio d519321a6a7fb34eb57ad3d767e4524c

using the R package listless with d3.js flare hierarchy

quick example of using @richierocks listless with the d3js flare.json hierachy

library(listless)
library(jsonlite)

# get flare.json from Mike Bostock example
#  https://bl.ocks.org/mbostock/raw/4063550/flare.json
flare <- jsonlite::fromJSON(
  "https://bl.ocks.org/mbostock/raw/4063550/flare.json",
  simplifyDataFrame = FALSE
)

list_depth

list_depth(flare)

## [1] 9

list_str

head(list_str(flare),10)

##       names  names.1  names.2 names.3 names.4 names.5 names.6 names.7
## 1      name     <NA>     <NA>    <NA>    <NA>    <NA>    <NA>    <NA>
## 2  children     name     <NA>    <NA>    <NA>    <NA>    <NA>    <NA>
## 3  children children     name    <NA>    <NA>    <NA>    <NA>    <NA>
## 4  children children children    name    <NA>    <NA>    <NA>    <NA>
## 5  children children children    size    <NA>    <NA>    <NA>    <NA>
## 6  children children children    name    <NA>    <NA>    <NA>    <NA>
## 7  children children children    size    <NA>    <NA>    <NA>    <NA>
## 8  children children children    name    <NA>    <NA>    <NA>    <NA>
## 9  children children children    size    <NA>    <NA>    <NA>    <NA>
## 10 children children children    name    <NA>    <NA>    <NA>    <NA>
##    names.8     class      mode length dims
## 1     <NA> character character      1     
## 2     <NA> character character      1     
## 3     <NA> character character      1     
## 4     <NA> character character      1     
## 5     <NA>   integer   numeric      1     
## 6     <NA> character character      1     
## 7     <NA>   integer   numeric      1     
## 8     <NA> character character      1     
## 9     <NA>   integer   numeric      1     
## 10    <NA> character character      1

list_to_data.frame

head(list_to_data.frame(flare),10)

##       names names.1  names.2 names.3  names.4 names.5 names.6 names.7
## 1      name    <NA>     <NA>    <NA>     <NA>    <NA>    <NA>    <NA>
## 2  children             name    <NA>     <NA>    <NA>    <NA>    <NA>
## 3  children         children             name    <NA>    <NA>    <NA>
## 4  children         children         children            name    <NA>
## 5  children         children         children            size    <NA>
## 6  children         children         children            name    <NA>
## 7  children         children         children            size    <NA>
## 8  children         children         children            name    <NA>
## 9  children         children         children            size    <NA>
## 10 children         children         children            name    <NA>
##    names.8               values
## 1     <NA>                flare
## 2     <NA>            analytics
## 3     <NA>              cluster
## 4     <NA> AgglomerativeCluster
## 5     <NA>                 3938
## 6     <NA>   CommunityStructure
## 7     <NA>                 3812
## 8     <NA>  HierarchicalCluster
## 9     <NA>                 6714
## 10    <NA>            MergeEdge

Built with blockbuilder.org