Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从R到html生成Sankey图_R_Sankey Diagram - Fatal编程技术网

从R到html生成Sankey图

从R到html生成Sankey图,r,sankey-diagram,R,Sankey Diagram,说到使用R,我是一个完全的新手,需要一些帮助。我已经成功地在R中创建了一个sankey图,但现在我想将其制作成一个可访问的html。我见过我的教授这样做,但当我试图用sankeyPlot$setTemplate函数复制它时,我丢失了sankey图,没有链接。下面是到目前为止我所拥有的允许sankey显示的内容 MSTsankey <- read_csv("C:Users/ammar/Desktop/Source Target Value 2.csv") # require(rCharts)

说到使用R,我是一个完全的新手,需要一些帮助。我已经成功地在R中创建了一个sankey图,但现在我想将其制作成一个可访问的html。我见过我的教授这样做,但当我试图用sankeyPlot$setTemplate函数复制它时,我丢失了sankey图,没有链接。下面是到目前为止我所拥有的允许sankey显示的内容

MSTsankey <- read_csv("C:Users/ammar/Desktop/Source Target Value 2.csv")
# require(rCharts)
sankeyPlot <- rCharts$new()
sankeyPlot$setLib('http://timelyportfolio.github.io/rCharts_d3_sankey')

workingdata <- MSTsankey
colnames(workingdata) <- c('source','target','value')
sankeyPlot$set(
  data = workingdata,
  nodeWidth = 15,
  nodePadding = 10,
  layout = 32,
  width = 1000
  height = 500
)
sankeyPlot

MSTsankey您需要保存绘图

sankeyPlot$save('mychart.html', standalone = TRUE)
其中,
sankeyPlot
是绘图变量,
mychart
是要保存的文件名