Click here for the interactive visualization
If you're interested in the visualisation of networks or graphs, you might've heard of the great package &quot;visNetwork&quot;. I think it's a really great package and I love playing around with it. The scenarios of graph-based analyses are many and diverse: whenever you can describe your data in terms of &quot;outgoing&quot; and &quot;receiving&quot; entities, a graph-based analysis and/or visualisation is possible. During my work as a linguist, I already used graphs for different purposes like linking-structures within dictionaries, visualising co-occurence patterns of words and so on.Today, I want to show you something completely different: transfers of male football players in the German &quot;1. Bundesliga&quot;, the first division of male football in Germany. We can also describe this data in terms of outgoing and receiving entities (the nodes in the network): the clubs who are selling the players and the clubs who are buying the players. The edges (connections) within the network are the players themselves. And there are further attributes associated with the edges, e.g. the price of the player.I'll spare you the boring details of getting the data (please write a comment if you would like more details on that). I start with the raw data structure created by the scraping process. It's a dataframe called transfer.df that looks like this:
&quot;abloese&quot; (or &quot;Ablöse&quot;) means &quot;transfer fee&quot; and currently holds a string with certain codes and the currency: &quot;ablösefrei&quot; means that no transfer fee had to be payed (remember the famous Bosman ruling?). &quot;-&quot; means that the information on a transfer fee doesn't make sense (e.g., when a player finishes his career). &quot;?&quot; means that no information about the transfer fee is available. &quot;Mio.&quot; and &quot;Tsd.&quot; just encodes &quot;million&quot; or &quot;thousand&quot;, we have to deal with that later.But we have to take care of something else first. In the dataframe, a player always appears twice if he changed teams within the 1. Bundesliga: the first time for his old club (as outgoing) and the second time for his new club (as incoming). I dealt with it this way (also, I loaded the required packages):library(visNetwork)library(igraph)library(stringr)
transfer.df2