When using ggraph for an igraph network, I get "Error in `$<-.data.frame`(`*tmp*`, "x", value = numeric(0)) : "

28 views Asked by At

I'm working with egocentric network data. I first created an egor object like this:

egor.obj <- egor::threefiles_to_egor(egos= ego.df, 
                                     alters.df= alter.attr.all, 
                                     edges= alter_ties, 
                                     ID.vars = list(ego = "networkCanvasEgoUUID", 
                                                    alter = "networkCanvasUUID", 
                                                    source = "networkCanvasSourceUUID", 
                                                    target = "networkCanvasTargetUUID"))

And then converted it into a list of igraph networks like this:

gr.list <- egor::as_igraph(egor.obj)

I'm trying to graph just one of those networks. So I used the egoID to pull out just one:

(gr.examp <- gr.list[["0012601c-c2b1-4881-ab25-b2a115f4530c"]])

And then tried visualizing it:

set.seed(607)
ggraph(gr.examp) + 
  geom_edge_link() + 
  geom_node_point(size=5, color="blue") + 
  theme_graph(base_family = 'Helvetica') 

It gives me the following output and error:

Using stress as default layout New names: • from -> from...1to -> to...2from -> from...4to -> to...5 New names: • from -> from...1to -> to...2from -> from...4to -> to...5 Error in $<-.data.frame(*tmp*, "x", value = numeric(0)) : replacement has 0 rows, data has 20

Can you help me figure out why it doesn't work?

I have checked that the graph isn't empty. It has 10 vertices and 20 edges, and when I do a simple plot with plot(gr.examp) it looks fine.

0

There are 0 answers