Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rstudio Addin for Network Analysis and Visualization

License

NotificationsYou must be signed in to change notification settings

schochastics/snahelper

Repository files navigation

R-CMD-checkCRAN statusDownloads

snahelper provides a set RStudio Addin for social network analysis.The main addin is theSNAhelper which provides a simple GUI to docommon network analytic tasks and visualize a network withggraph.

The second addin, calledNetbuilder allows you to quickly build smallnetworks with a small “canvas” to draw on. The network can be exportedas an igraph object at the end of the session by clicking on “Done”.

The third addinNetreader is meant to facilitated the import of rawnetwork data. It provides a GUI to easily read network and attributedata and combine them to an igraph object. The underlying code of theimport procedure is shown at the end. This should help users to learnimporting data themselves.

The fourth addinComponentlayouter allows to layout networks withseveral components manually by placing them on an empty canvas.Components can also be rotated and resized. After finishing the session,the layout is saved as x and y vertex attributes.

Quick look at the SNAhelper

Code to reproduce the used network.

library(tidyverse)library(igraph)url<-"https://raw.githubusercontent.com/evelinag/StarWars-social-network/master/networks/starwars-full-interactions-allCharacters.json"df<-jsonlite::fromJSON(url)df$nodes$id<-1:nrow(df$nodes)df$nodes$display<-df$nodes$namedf$nodes$name<-df$nodes$id-1g<- graph_from_data_frame(df$links,directed=F,vertices=df$nodes)V(g)$name<- V(g)$displayg<- remove.vertex.attribute(g,"id")g<- remove.vertex.attribute(g,"display")g<- delete.vertices(g,which(degree(g)==0))V(g)$display<- ifelse(V(g)$value>75,V(g)$name,"")V(g)$colour<- ifelse(V(g)$display=="",NA,V(g)$display)g

Quick look at the Netreader

Netreader should be pretty selfexplanatory. The first two tabs allowyou to import raw data (edges and attributes). Make sure to specify filedelimiters, etc. according to the shown preview.

Using theNetreader should comes with a learning effect (hopefully).The last tab shows the R code to produce the network with the chosendatawithout using the Addin.

The network will be saved in your global environment once you click“Done”.

Quick look at the Netbuilder

Quick look at the Componentlayouter

Highlight an igraph object in your script and selcet theComponentlayouter from the RStudio addin menu. Components are added byclicking on the canvas and can be resized/rotated and re-positionedusing the buttons at the bottom. The final layout is stored as x and ycoordinates in the igraph object.

Installation

# developer version#install.packages(remotes)remotes::install_github("schochastics/snahelper")#CRAN versioninstall.packages("snahelper")

To work properly, you also needgraphlayouts, which addsnew layout algorithms.

install.packages("graphlayouts")

Usage of SNAhelper

To use the main addin, simply highlight a network in your script andselectSNAhelper from the Addin dropdown menu.

Interface

Layout

The layout tab allows you to choose from all implemented algorithms inigraph and some layouts fromgraphlayouts. The default is a stressbased layout and also the recommended choice. Seemyblog foran explanation. In the tweak section you can move individual nodesaround. Choose the node from the dropdown menu and click on its newposition in the plot.

Node Attribute Manager

The Node Attribute Manager shows all existing node attributes in asortable table. In addition, you can calculate some new ones (centralityand clustering). The functions automatically choose the right version ofindices, depending if the network isdirected/weighted/undirected/unweighted.

Nodes

This is where you can style your nodes. You can either do it manually,by choosing a color/size for all nodes together, or based on anattribute.

Edge Attribute Manager

Same as Node Attribute Manager but for edges. So far only shows existingedge attributes.

Edges

You can style your edges here.snahelper automatically detects if yournetwork is directed and adds arrows if the network is directed. Theother options are similar to the nodes tab. The snahelper automaticallychooses the appropriate edge geom. If multiple edges are present, itusesgeom_edge_parallel0(). Otherwisegeom_edge_link0().

Result

The result tab shows the network in its full size. If you are satisfiedwith the results, hit the Done button and the R code to produce the plotis automatically inserted in your script. Or you can directly save theresult as a png file.

About

Rstudio Addin for Network Analysis and Visualization

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp