0

I've created a radial dendrogram, but it lookes quite messy because some of my branches end on level 4, others on 5 or 6. To resolve this, I have created empty nodes, but that's an ugly technique because they're distracting and don't mean anything. My dataset looks like this:

Level1;Level2;Level3;Level4;Level5;Level6
Indo-European;Albanian;Gheg; ; ;Gheg Albanian
Indo-European;Albanian;Tosk; ; ;Arbereshe Albanian
Indo-European;Albanian;Tosk; ; ;Arvanitika Albanian
Indo-European;Albanian;Tosk; ; ;Tosk Albanian
Indo-European;Armenian; ; ; ;Armenian
Indo-European;Armenian; ; ; ;Western Armenian
Indo-European;Balto-Slavic;Slavic;South;Eastern;Bulgarian
Indo-European;Balto-Slavic;Slavic;South;Eastern;Macedonian
Indo-European;Balto-Slavic;Slavic;South;Eastern;Church Slavonic

And here is the code I've used:

courses <- read.csv("courses.csv", sep=";",header=TRUE, stringsAsFactors = FALSE)
head(courses)
str(courses)
library(data.tree)
courses$pathString <- paste("courses",courses$Level1,courses$Level2,courses$Level3,courses$Level4,courses$Level5,courses$Level6, sep= "|")
head(courses)
coursesTree <- as.Node(courses, pathDelimiter = "|")
coursesTree
coursesTreeList <- ToListExplicit(coursesTree, unname =TRUE)
library(networkD3)
radialNetwork(List=coursesTreeList, 
                fontSize = 13,
                fontFamily = "OpenSans-Light",
                nodeStroke = "orange",
                opacity = 0.9)

Is there a way to make them all end on level 6 without creating empty nodes? Or can I at least say something alone the lines of IF Node=" " THEN make it really small AND nodeStroke = "grey" END to hide them?

Omega
  • 750
  • 1
  • 8
  • 24
  • That capability is not built in to the CRAN release version of `networkD3`, but the dev version on Github can do both of those things (extending branches to the full depth and choosing custom color and size for individual nodes) with the `treeNetwork` function. – CJ Yetman Jan 21 '19 at 15:31
  • Thanks, I'll check it out! – Omega Jan 21 '19 at 18:08

0 Answers0