2017-02-18 63 views
1

我是一个完整的新手,当涉及到使用R并需要一些帮助。我已经在R中成功制作了sankey图表,但现在想把它变成一个可访问的html。我见过我的教授这样做,但是当我尝试使用sankeyPlot $ setTemplate函数复制它时,我失去了sankey图并且没有链接。以下是我目前所能看到的sankey。生成Sankey图到从R的HTML

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 

回答

1

您需要保存该图。

sankeyPlot$save('mychart.html', standalone = TRUE) 

哪里sankeyPlot是情节变量,mychart是要保存的文件名。