The main reason why

After all, I am still an Internal Auditor. Therefore I often face one of the typical internal auditors problems: understand links between people and companies, in order to discover the existence of hidden communities that could expose the company to unknown risks.

the solution: linker

In order to address this problem I am developing Linker, a lean shiny app that take 1 to 1 links as an input and gives as output a network map:
the Linker
click the picture to reach the app

Linker is packed with a demo network, but you can easily load your dataset following the tutorial below.
network

how to use linker ( and some code specs)

the one that follow is a tutorial with some focus on code, if you are interested in giving a look to the full reprocudibile Rstudio project, I make it available at the end of the post.

decribing data describing data

Linker is only able to read .csv datasets, structured as “hedge-to-hedge” tables.
This mean you will have to create a two-column table, having on each row a link.
For instance, suppose A is linked with B, C is linked with A and B is linked with D; this will be your dataset:
from to
A B
C A
B D
be sure to set “;” as a separator in your .csv file.

upload119 loading data

using the ‘load file’ control you can choose the dataset to load.
ScreenClip

circles23 connecting dots

Linker leverages the great features builted in the linkComm package by Alex T. Kalinka and Alain Guenoche .
Therefore, the first step required is to create a linkComm object, containing the network map and informations about founded communities.
This object is obtained through the getLinksCommunities() function. This function takes your dataset as an input and, applying a clustering method, gives as an output the network map aggregated by community.

links_graph <- getLinkCommunities(links_file(),hcmethod="mcquitty",
                                      use.all.edges = TRUE)
just note that:
  • Linker use as hierarchical clustering method the mcquitty method. There are other clustering methods available. just type ?getLinkCommunities() in your console to discover them;
  • the parameter use.all.edges is set to TRUE in order to show in the network all member of your networks.

round51 Plotting the map

as soon as Linker creates the getLinkCommunities object, it will return, in the”network map” area, a visual representation of your network.
the default graph is the spencer circle, a graph developed by Rob Spencer starting from a 2010 paper by Yong-Yeol Ahn , James P. Bagrow and Sune Lehmann .
If you prefer, you can change the graphing layout  to circle.
graph type choice
I think this second way is a bit more clearer, even if is not as impacting as the Spencer Circle.

search100 Advanced topics

highligthing most relevant subjects

not all the subjects in your network have got the same relevance. If you want to focus just on the most influent subjects, you can use the “number of communities” option.
This option lets you focus on subjects being part of at least n communities, starting from one to infinite.
number of communities
code spec
the option uses the shownodesin argument
shownodesin = input$"n_input"

focusing on a single community

If you want to focus on a single community, you can just type the community id into the ‘community to focus on’.
Community’s id are printed around the circle in the spencer circle layout.
focus on single community
code spec
these option is builted using the clusterids argumenti within the plot function:
clusterids = c(as.numeric(input$selected_communities))

export your map

this is not actually a feature created within the application, but could be better described as a trick:
if you want to export your map, just right-click on the map and select “save image”.

the Rstudio Project.

to download the full project, just click the button below.

download the Linker R studio project App

If you found Linker useful, you may be interested in other Shiny Apps I developed for analytics and productivity purposes. Find them out at software page
Icons made by Google from www.flaticon.com is licensed under CC BY 3.0
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s