I have a hierarchical but row based spreadsheet file that looks like this when imported :
stuff = {{"Level1a", , , }
, {"Level1a", "Level2a", ,}
, {"Level1a", "Level2a", "Level3a",}
, {"Level1a", "Level2a", "Level3b",}
, {"Level1a", "Level2a", "Level3b", "Level4a"}
, {"Level1a", "Level2a", "Level3b", "Level4b"}
, {"Level1b", , , }
, {"Level1b", "Level2b", "Level3c",}
, {"Level1b", "Level2b", "Level3d",}} // TableForm
I would like to arrange it into rows and columns like below except for some reason the align top doesn't work :
Row[{"Level1a",
Column[{"Level2a", Column[{" Level3a", " Level3b"}], "Level2b"}],
" Level1b", Column[{"Level2c", "Level2d"}]},
Alignment -> {Top, Top}]
(* Actual result wanted :
Level1a Level1b
Level2a Level2c
Level3a Level3c
Level3b
Level2b *)
My objective is 2 fold : 1. Reformat the data.
This is how far I have got on the reformatting - I can get Parent-Child pairs :
DeleteDuplicates[Flatten[Partition[stuff, {1, 2}, 1], 2]]
(* result {{"Level1a", Null}, {Null, Null}, {"Level1a", "Level2a"}, {"Level2a",
Null}, {"Level2a", "Level3a"}, {"Level3a", Null}, {"Level2a",
"Level3b"}, {"Level3b", Null}, {"Level3b", "Level4a"}, {"Level3b",
"Level4b"}, {"Level1b", Null}, {"Level1b", "Level2b"}, {"Level2b",
"Level3c"}, {"Level3c", Null}, {"Level2b", "Level3d"}, {"Level3d",
Null}} *)
- Introduce Grid/Column/Row as appropriate to create the structure I want. I have already tried Map-ping but can't find a way to get them in the right place.
Row
is not appropriate for what you are trying to accomplish. You should useGrid
. See ZachB answer. $\endgroup$