convert a data.tree to a JSON format for r2d3 circlepacking

Hi,
I want to use r2d3 to produce a circlepacking diagram, like this: Gallery: circlepacking • r2d3

I have data for a list of counties. The data is stored in a data.tree format:

               levelName           x           y  r

1 state NA NA NA
2 ¦--1 NA NA NA
3 ¦ ¦--Adams County 0.70216681 -1.74887559 3
4 ¦ ¦--Arapahoe County 2.42205959 -2.27641502 6
5 ¦ ¦--Boulder County 2.45536318 -0.56654636 5
6 ¦ ¦--Denver County 2.64068227 -4.07715390 7
7 ¦ ¦--El Paso County 2.11206773 -2.04160033 5
8 ¦ ¦--Jefferson County 2.34846976 -1.33285324 5
9 ¦ ¦--Larimer County 1.68221234 -0.59603287 4
10 ¦ °--Weld County 0.69764274 -0.57847535 2
11 ¦--2 NA NA NA
12 ¦ ¦--Alamosa County -1.16965226 -0.10081783 3

The listing shows cluster 1 of 4 (and one line from cluster 2)

How do I convert this data into a hierarchal JSON layout (like "flare.json") that will produce the desired D3 visualization?

I'd appreciate any hints or blogs that will help.
TIA
AB

I found a solution: http://jeromefroe.github.io/circlepackeR/
Thanks @jeromefroe

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.