How can I distribute R visualizations to other users that don't have R?
I have a created a Sankey diagram in R based on the following code (Link), which works great:
library(networkD3)
library(jsonlite)
library(magrittr)
energy <- "https://cdn.rawgit.com/christophergandrud/networkD3/master/JSONdata/energy.json" %>%
fromJSON
sankeyNetwork(Links = energy$links,
Nodes = energy$nodes,
Source = "source",
Target = "target",
Value = "value",
NodeID = "name",
units = "TWh",
fontSize = 12,
nodeWidth = 30)
But, how can I pass this diagram to other users? I was thinking maybe to render it in a web page, but I don't know how.
Any ideas?
Thanks
If you are using RStudio then you can compile an HTML report using GUI: This will quickly create an HTML file with your code and the interactive plot.
Alternatively, you could also knit an R markdown document with your code. More info here. Please bear in mind that only HTML version will be interactive.