Data Frame
df <- data.frame(
  "Level" = c(0,1,2,2,1,2)
  ,"Name" = c("A","B","C","D","E","F")
  ,"Value" = 1:6
  ,stringsAsFactors = FALSE
)
If level of next row is greater than the present row then it is a child of present row.
For example the above data frame is to be converted into a chart as shown below
Diagonal Network
What I have tried
1)Converted data frame to csv(Data.csv),then converted csv to JSON using jsonlite and thereafter passed it as a list to diagonalnetwork function.Please refer below for same and update the Path
library(networkD3)
library(jsonlite)
setwd(Path)
df <- data.frame(
  "Level" = c(0,1,2,2,1,2)
  ,"Name" = c("A","B","C","D","E","F")
  ,"Value" = 1:6
  ,stringsAsFactors = FALSE)
write.csv(df, file =Path, row.names = FALSE)
data1DF<-read.csv("Data.csv", header=TRUE, sep=",")
myjson<-jsonlite::toJSON(data1DF)
write(myjson, "data.json")
Flare <- jsonlite::fromJSON("data.json", simplifyDataFrame =FALSE)
diagonalNetwork (List= Flare, fontSize = 10, opacity = 0.9, margin=0)
2)Converted data frame to JSON using data.tree package and then pass as list to diagonalnetwork function
library(data.tree)
library(networkD3)
df <- data.frame("Level" = c(0,1,2,2,1,2)
      ,"Name" = c("A","B","C","D","E","F")
      ,"Value" = 1:6
      ,stringsAsFactors = FALSE)
 df$pathString <- paste("root2", df$Level, df$Name, df$Value, sep="/")
 root2 <-as.Node(df[,-c(1, 2)])
 root2 <-as.list(root2)
 diagonalNetwork (List= root2, fontSize = 10, opacity = 0.9, margin=0)
But both my attempts didn't provide the desired result.
What I really need
A solution to generate diagonal network chart from a data frame of thousands of row with hierarchy similar to our data frame. No constraints on the orientation of chart whether top down or left right,all i need is my data frame in proper hierarchy. Ultimately this chart will be used in R shiny based application.Kindly provide solution accordingly.

 
     
     
    