Dear R-community It would be nice to get some input how to find a solution for the following error in igraph and vertex setting. Thank you very much Sibylle> par(bg="black")> network %>% plot(+ vertex.color=clrs[V(.)$community], + vertex.size=V(.)$hub_score*1, + vertex.frame.color=V(.)$color, + vertex.label.color="white", + vertex.label.cex=0.5, + vertex.label.family="Helvetica", + vertex.label.font=1, + edge.curved=0.5, + edge.width= network, + layout=layout_with_mds(.)) Error in intI(i, n = x at Dim[1], dn[[1]], give.dn = FALSE) : Index gr??er als maximales 6 Reproducible example: edge_list<-read.csv("edges_table_Test.csv") #create network and add some necessary attributes (vertices) for the plot network <- graph_from_data_frame(aes_collapsed, directed= FALSE, vertices = details) temp<-cluster_optimal(network) temp<-cbind(membership=temp$membership, Names=temp$name) aes_collapsed <- aes_collapsed %>% merge(temp, by="Names") network <- network %>% set_edge_attr(name = "type", value = factor(aes_collapsed$Names, ordered is.ordered(V(network)$name))) %>% set_edge_attr(name = "membership", value = aes_collapsed$membership) %>% set_edge_attr(name = "color", value = c(viridis::viridis(5)) [match(E(.)$type, c(factor(V(.)$name)))]) %>% set_vertex_attr(name = "trans_v_net", value = c(transitivity(., type "local"))) %>% set_vertex_attr(name = "hub_score", value = c(hub_score(.)$vector)) %>% set_vertex_attr(name = "color", value = c(viridis::viridis((5))) [match(V(.)$name, c(factor(V(.)$name)))]) %>% set_vertex_attr(name= "community", value=cluster_optimal(.)$membership) clrs<-scico(3, palette = "batlow") par(bg="black") network %>% plot( vertex.color=clrs[V(.)$community], vertex.size=V(.)$hub_score*5, vertex.frame.color=V(.)$color, vertex.label.color="white", vertex.label.cex=0.5, vertex.label.family="Helvetica", vertex.label.font=1, edge.curved=0.5, edge.width= network, layout=layout_with_mds(.)) edges_table_Test.csv Names target weight B.B A.A 4 C.C A.A 5 D.D A.A 5 E.E A.A 5 F.F A.A 1 C.C B.B 5 E.E B.B 1 F.F B.B 2 A.A C.C 5 B.B C.C 1 D.D C.C 5 E.E C.C 5 F.F C.C 3 A.A D.D 5 B.B D.D 1 C.C D.D 5 E.E D.D 5 F.F D.D 4 A.A E.E 5 B.B E.E 1 C.C E.E 4 D.D E.E 5 F.F E.E 5 A.A F.F 5 B.B F.F 1 C.C F.F 2 D.D F.F 3 E.E F.F 4 F.F F.F 5 [[alternative HTML version deleted]]
The reason html is specifically advised against as a format is that it does things like mangling data such as is happening in your example. You should repost using settings on you mail client for plain-text. Your code should start by loading necessary packages. You should also not post screen output versions of code since that will insert lots of superfluous "+"'s. Some but not all API will be able to strip those characters. -- David. On 2/24/24 03:09, SIBYLLE ST?CKLI via R-help wrote:> Dear R-community > > > > It would be nice to get some input how to find a solution for the following > error in igraph and vertex setting. > > > > Thank you very much > > Sibylle > >> par(bg="black") >> network %>% plot( > + vertex.color=clrs[V(.)$community], > > + vertex.size=V(.)$hub_score*1, > > + vertex.frame.color=V(.)$color, > > + vertex.label.color="white", > > + vertex.label.cex=0.5, > > + vertex.label.family="Helvetica", > > + vertex.label.font=1, > > + edge.curved=0.5, > > + edge.width= network, > > + layout=layout_with_mds(.)) > > Error in intI(i, n = x at Dim[1], dn[[1]], give.dn = FALSE) : > > Index gr??er als maximales 6 > > > > > > Reproducible example: > > > > edge_list<-read.csv("edges_table_Test.csv") > > > > #create network and add some necessary attributes (vertices) for the plot > > network <- graph_from_data_frame(aes_collapsed, directed= FALSE, > > vertices = details) > > > > > > temp<-cluster_optimal(network) > > temp<-cbind(membership=temp$membership, Names=temp$name) > > aes_collapsed <- aes_collapsed %>% > > merge(temp, by="Names") > > > > > > network <- network %>% > > set_edge_attr(name = "type", value = factor(aes_collapsed$Names, > > ordered > is.ordered(V(network)$name))) %>% > > set_edge_attr(name = "membership", value = aes_collapsed$membership) %>% > > set_edge_attr(name = "color", > > value = c(viridis::viridis(5)) > > [match(E(.)$type, c(factor(V(.)$name)))]) %>% > > set_vertex_attr(name = "trans_v_net", value = c(transitivity(., type > "local"))) %>% > > set_vertex_attr(name = "hub_score", value = c(hub_score(.)$vector)) %>% > > set_vertex_attr(name = "color", > > value = c(viridis::viridis((5))) > > [match(V(.)$name, c(factor(V(.)$name)))]) %>% > > set_vertex_attr(name= "community", value=cluster_optimal(.)$membership) > > > > clrs<-scico(3, palette = "batlow") > > > > par(bg="black") > > network %>% plot( > > vertex.color=clrs[V(.)$community], > > vertex.size=V(.)$hub_score*5, > > vertex.frame.color=V(.)$color, > > vertex.label.color="white", > > vertex.label.cex=0.5, > > vertex.label.family="Helvetica", > > vertex.label.font=1, > > edge.curved=0.5, > > edge.width= network, > > layout=layout_with_mds(.)) > > > > > > edges_table_Test.csv > > > > > Names > > target > > weight > > > B.B > > A.A > > 4 > > > C.C > > A.A > > 5 > > > D.D > > A.A > > 5 > > > E.E > > A.A > > 5 > > > F.F > > A.A > > 1 > > > C.C > > B.B > > 5 > > > E.E > > B.B > > 1 > > > F.F > > B.B > > 2 > > > A.A > > C.C > > 5 > > > B.B > > C.C > > 1 > > > D.D > > C.C > > 5 > > > E.E > > C.C > > 5 > > > F.F > > C.C > > 3 > > > A.A > > D.D > > 5 > > > B.B > > D.D > > 1 > > > C.C > > D.D > > 5 > > > E.E > > D.D > > 5 > > > F.F > > D.D > > 4 > > > A.A > > E.E > > 5 > > > B.B > > E.E > > 1 > > > C.C > > E.E > > 4 > > > D.D > > E.E > > 5 > > > F.F > > E.E > > 5 > > > A.A > > F.F > > 5 > > > B.B > > F.F > > 1 > > > C.C > > F.F > > 2 > > > D.D > > F.F > > 3 > > > E.E > > F.F > > 4 > > > F.F > > F.F > > 5 > > > > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hi, first of all, your example was not reproducible! But once I added "library(igraph)" and "library(scico)" plus generally replaced "aes_collapsed" by "edge_list", I started to work :-) Anyway, the error is produced by this line: + edge.width= network, It seems to me that you have forgotten to name a variable here (you now use the whole network object as variable, which most probably won't work). Just as a kind advice for the future: if you encounter errors like this, it is always a good idea to debug the problematic code by commenting it out line by line. So you will - most probably - find our those sections resulting in errors. HTH, Kimmo la, 2024-02-24 kello 12:09 +0100, SIBYLLE ST?CKLI via R-help kirjoitti:> Dear R-community > > ? > > It would be nice to get some input how to find a solution for the > following > error in igraph and vertex setting. > > ? > > Thank you very much > > Sibylle > > ? > > > par(bg="black") > > > network %>% plot( > > +???? vertex.color=clrs[V(.)$community], > > +???? vertex.size=V(.)$hub_score*1, > > +???? vertex.frame.color=V(.)$color, > > +???? vertex.label.color="white", > > +???? vertex.label.cex=0.5, > > +???? vertex.label.family="Helvetica", > > +???? vertex.label.font=1, > > +???? edge.curved=0.5, > > +???? edge.width= network, > > +???? layout=layout_with_mds(.)) > > Error in intI(i, n = x at Dim[1], dn[[1]], give.dn = FALSE) : > > ? Index gr??er als maximales 6 > > ? > > ? > > Reproducible example: > > ? > > edge_list<-read.csv("edges_table_Test.csv") > > ? > > #create network and add some necessary attributes (vertices) for the > plot > > network <- graph_from_data_frame(aes_collapsed, directed= FALSE, > > ???????????????????????????????? vertices = details) > > ? > > ? > > temp<-cluster_optimal(network) > > temp<-cbind(membership=temp$membership, Names=temp$name) > > aes_collapsed <- aes_collapsed %>% > > ? merge(temp, by="Names") > > ? > > ? > > network <- network %>% > > ? set_edge_attr(name = "type", value = factor(aes_collapsed$Names, > > ???????????????????????????????????????????????? ordered > is.ordered(V(network)$name))) %>% > > ? set_edge_attr(name = "membership", value > aes_collapsed$membership) %>% > > ? set_edge_attr(name = "color", > > ????????????? value = c(viridis::viridis(5)) > > ????????????? [match(E(.)$type, c(factor(V(.)$name)))]) %>% > > ? set_vertex_attr(name = "trans_v_net", value = c(transitivity(., > type > "local"))) %>% > > ? set_vertex_attr(name = "hub_score", value = c(hub_score(.)$vector)) > %>% > > ? set_vertex_attr(name = "color", > > ????????????? value = c(viridis::viridis((5))) > > ????????????? [match(V(.)$name, c(factor(V(.)$name)))]) %>% > > ? set_vertex_attr(name= "community", > value=cluster_optimal(.)$membership) > > ? > > clrs<-scico(3, palette = "batlow") > > ? > > par(bg="black") > > network %>% plot( > > ???? vertex.color=clrs[V(.)$community], > > ???? vertex.size=V(.)$hub_score*5, > > ???? vertex.frame.color=V(.)$color, > > ???? vertex.label.color="white", > > ???? vertex.label.cex=0.5, > > ???? vertex.label.family="Helvetica", > > ???? vertex.label.font=1, > > ???? edge.curved=0.5, > > ???? edge.width= network, > > ???? layout=layout_with_mds(.)) > > ? > > ? > > edges_table_Test.csv > > ? > > > Names > > target > > weight > > > B.B > > A.A > > 4 > > > C.C > > A.A > > 5 > > > D.D > > A.A > > 5 > > > E.E > > A.A > > 5 > > > F.F > > A.A > > 1 > > > C.C > > B.B > > 5 > > > E.E > > B.B > > 1 > > > F.F > > B.B > > 2 > > > A.A > > C.C > > 5 > > > B.B > > C.C > > 1 > > > D.D > > C.C > > 5 > > > E.E > > C.C > > 5 > > > F.F > > C.C > > 3 > > > A.A > > D.D > > 5 > > > B.B > > D.D > > 1 > > > C.C > > D.D > > 5 > > > E.E > > D.D > > 5 > > > F.F > > D.D > > 4 > > > A.A > > E.E > > 5 > > > B.B > > E.E > > 1 > > > C.C > > E.E > > 4 > > > D.D > > E.E > > 5 > > > F.F > > E.E > > 5 > > > A.A > > F.F > > 5 > > > B.B > > F.F > > 1 > > > C.C > > F.F > > 2 > > > D.D > > F.F > > 3 > > > E.E > > F.F > > 4 > > > F.F > > F.F > > 5 > > ? > > > ????????[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org?mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.