Grokbase Groups R r-help March 2012
Dear R-list,

I am trying to visualize where the dropout happens in our patient flow. We are currently using traditional flowcharts and it bothers me that I can't visualize both the percentage and the flow in one diagram.

The other day I came across some interesting diagrams doing exactly what I wanted, they had both flow and percentages visualized on one diagram. Here is some nice examples apparently made with ?sankeypython?

It didn't take long to find a blog where a Ruser (thanks!) had posted an R script that actually produces an Sankey Diagram in R

See below for working example.

My questions are, is this the most updated Sankey Diagram-script we have in the R community? Is there a better way to visualize flow and percentages in one diagram in R?


## the working example

## th,
sourc.https <- function(url, ...) {
? # load package
? # install.packages(c("RCurl"), dependencies = TRUE)

? # 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)
? })

# Example from

# My example (there is another example inside Sankey.R):
inputs = c(6, 144)
losses = c(6,47,14,7, 7, 35, 34)
unit = "n ="
labels = c("Transfers",
?????????? "Referrals\n",
?????????? "Unable to Engage",
?????????? "Consultation only",
?????????? "Did not complete the intake",
?????????? "Did not engage in Treatment",
?????????? "Discontinued Mid-Treatment",
?????????? "Completed Treatment",
?????????? "Active in \nTreatment")

# Clean up my mess
rm("inputs", "labels", "losses", "SankeyR", "sourc.https", "unit")

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupr-help @
postedMar 19, '12 at 6:52a
activeMar 19, '12 at 6:52a

1 user in discussion

Eric Fail: 1 post



site design / logo © 2017 Grokbase