Thomas
Thomas

Reputation: 1444

Create list from data.frame

I'm trying to produce a sankey-plot using the package riverplot in R. In order to do that I need to create a riverplot object. Following the vignette here this seems quite straightforward. Unfortunately, it is not.

I get the an error message and am unable to identify why. Can anyone help?

install.packages("riverplot")
library(riverplot)

edges <- data.frame(N1=rep("SP", 8), 
                  N2=c("AL", "CVP", "EVP", "FDP", "GPS", "glp", "SVP", "SP"),
                  Value=c(77,1,1,1,20,9,1,103))

nodes <- data.frame(ID=c("SP", "AL", "CVP", "EVP", "FDP", "GPS", "glp", "SVP", "SP"),
                  x=c(1, 2,2,2,2,2,2,2,2))

r.file <- makeRiver(nodes, edges)

Error in `row.names<-.data.frame`(`*tmp*`, value = value) : 
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique value when setting 'row.names': ‘SP’ 

Of course row.names(edges) <- NULL and row.names(nodes) <- NULL don't solve the problem. Can anyone help?

Thanks.

Upvotes: 1

Views: 170

Answers (0)

Related Questions