I'm making a Sankey diagram using the networkD3 package, I have included my code below. I want to add a title, footnotes, and label both the left side and right side of the diagram. But I'm not sure how to do this as networkD3 has no built in labeling commands
library(dplyr)
library(networkD3)
library(htmlwidgets)
Comp_Noncomp<-c("A","B","C","A","B","C","A","B","C")
Category<-c("D","E","F","D","E","F","D","E","F")
Frequency<-c(1,2,3,4,5,6,7,8,9)
my.data.3<-data.frame(Comp_Noncomp,Category,Frequency)
nodes <- data.frame(name=c(as.character(my.data.3$Comp_Noncomp), as.character(my.data.3$Category)) %>% unique())
my.data.3$IDsource=match(my.data.3$Comp_Noncomp, nodes$name)-1
my.data.3$IDtarget=match(my.data.3$Category, nodes$name)-1
library(networkD3)
sankeyNetwork(Links = my.data.3, Nodes = nodes,
Source = "IDsource", Target = "IDtarget",
Value = "Frequency", NodeID = "name",
sinksRight=FALSE)