I am trying to make Sankey graphs, however, the networkd3 package doesn't seem to work right. When I try to install it in R, the following error comes up:
Error: package or namespace load failed for ‘networkD3’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘igraph’
I am just starting out with R and can use your help to rectify this.
I am trying to make Sankey graphs using this package.
I see two solutions.
If you wish to continue using NetworkD3
, you will need to install iGraph
. This is what the error states. Please have a look at the documentation here: igraph-Installation.
Installing iGraph can be a little tricky depending on your machine you are working with. Another solution would be to use ggalluvial
, a R library that works with ggplot to build sankey diagrams i.e. alluvial plots. You may find a nefty tutorial here: ggalluvial-tutorial