briatte / ggnetwork

Geoms to plot networks with ggplot2
https://briatte.github.io/ggnetwork/
146 stars 27 forks source link

Edge attributes not converted to factors #55

Closed briatte closed 5 years ago

briatte commented 5 years ago

The problems described in #53 and #54 have a little cousin:

https://github.com/briatte/ggnetwork/blob/2d366822248e17920a64019160b79c217c30db79/R/fortify-network.R#L205

rbind uses the types of the first argument (here nodes) to determine the types of the second one. This causes edge attributes of class character to never be returned as factors, even if the user asks so (which is the default: see #53).

The problem affects both fortify.network and fortify.igraph.

The arguments passed to rbind need to be reversed, which will affect the result of ggnetwork but should not affect plots produced with it.