我试图用R中的Sankey图来可视化我的数据流.
我发现这个博客文章链接到一个产生Sankey图的R脚本,不幸的是它非常原始且有些局限(见下面的示例代码和数据).
有没有人知道其他脚本 - 或者甚至是一个更开发的包?我的最终目标是通过图表组件的相对大小来可视化数据流和百分比,就像在这些Sankey Diagrams示例中一样.
我在r-help列表上发布了一个类似的问题,但是经过两周没有任何回复,我在stackoverflow上尝试运气.
谢谢,埃里克
PS.我知道并行集图,但这不是我想要的.
# thanks to, https://tonybreyal.wordpress.com/2011/11/24/source_https-sourcing-an-r-script-from-github/
sourc.https <- function(url, ...) {
# install and load the RCurl package
if (match('RCurl', nomatch=0, installed.packages()[,1])==0) {
install.packages(c("RCurl"), dependencies = TRUE)
require(RCurl)
} else require(RCurl)
# parse and evaluate each .R script
sapply(c(url, ...), function(u) {
eval(parse(text = getURL(u, followlocation = TRUE,
cainfo = system.file("CurlSSL", "cacert.pem",
package = "RCurl"))), envir = .GlobalEnv)
} )
}
# from …Run Code Online (Sandbox Code Playgroud)