Sankey network does not render in flexdashboard

Hello R community. I have made a really nice but really large Sankey network using the networkd3 r package. There are 173 nodes with 4 levels of links. it renders well in rstudio. however, when I render it in Flexdashboard I only get a compressed diagram with very thin links without the nodes. My code example is below:

library(networkD3)
library(plyr)
library(tidyverse)

#the link data
sdg_san3 <- TY %>% group_by(Target_Conditions, SDI) %>% add_count(SDI) %>% mutate(value = n * 100)
colnames(sdg_san3) <- c("source", "target", "n", "value")

#the node data 
NOD_sdg3 <- data.frame(name = c(as.character(sdg_san3$source), as.character(sdg_san3$target)) %>% unique())

#making the Sankey
sdg_san3$sdsource <- match(sdg_san3$source, NOD_sdg3$name)-1
sdg_san3$sdtarget <- match(sdg_san3$target, NOD_sdg3$name)-1
s3 <- networkD3::sankeyNetwork(Links = sdg_san3, Nodes = NOD_sdg3, 
                         Source = 'sdsource', Target = 'sdtarget', 
                         Value = 'value', NodeID = 'name', units = 'frequency', fontSize = 12, nodeWidth = 45, height = 1500, width = 1200)
s3

I don not have any shiny widgets at this time.
If anyone can help to identify what the problem is I would really appreciate it.
thanks

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