桑基图R不显示降价

问题描述

我正在处理 R 降价文档,但被“sankey 图表”元素困住了。 Sankey 元素在其代码中运行良好,但是当我编织 Markdown 时,该元素不会出现在 Markdown 中(或者只是空白 [?])。

迁移流程

library(networkD3)

# creating the df    
uni_reenrolled <- c("CBS","KU","DTU","RUC","AU","ITU","AAU","SDU","CBS","ITU")

uni_dropout<- c("CBS","AU")

dropout <- c(274,272,48,40,29,27,25,22,604,275,66,53,41,23,21,16,8,6,1093,199,175,141,129,99,78,55,147,44,18,14,12,1254,124,56,45,28,5,939,140,85,69,24,1810,176,166,94,34,33,5)

sankey_uni_data <- data.frame(dropout,uni_reenrolled,uni_dropout)%>%
  mutate(uni_reenrolled = paste0(" ",uni_reenrolled ))

# creating the sankey-chart
node_names <- (c(as.character(unique(sankey_uni_data$uni_dropout)),unique(as.character(sankey_uni_data$uni_reenrolled))))
nodes <- data.frame(name = node_names)

links <- data.frame(source = match(sankey_uni_data$uni_dropout,node_names) - 1,target = match(sankey_uni_data$uni_reenrolled,value = sankey_uni_data$dropout)


sn <-sankeyNetwork(Links = links,Nodes = nodes,Source = "source",Target = "target",Value = "value",NodeID = "name",units = "dropouts",fontSize = 25,nodeWidth = 30,fontFamily = "sans-serif",iterations = 0)
sn

当我运行代码时,图表出来的很好enter image description here,但是当我编织它时,它没有显示,只是将降价页面留空。

感谢任何帮助。谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)