<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/euro-2016-squads/"></div></div><div><a data-url="http://www.r-bloggers.com/euro-2016-squads/" data-counturl="http://www.r-bloggers.com/euro-2016-squads/" data-count="horizontal" data-text="Euro 2016 Squads" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://gjabel.wordpress.com/2016/06/15/euro-2016-squads/"> R – Guy Abel</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>This weekend I was having fun in France watching some Euro 2016 matches, visiting friends and avoiding Russian hooligans. Before my flight over I scraped some tables on the tournaments Wikipedia page with my newly acquired <code>rvest</code> skills, with the idea to build up a bilateral database of Euro 2016 squads and their players clubs.</p>
<p>On the flight I managed to come up with some maps showing these connections. First off I used <code>ggplot2</code> to plot lines connecting the location of every players club teams to their national squads base in France. The path of the lines were calculated using the <code>gcIntermediate</code> function in the <code>geosphere</code> <a target="_blank" href="https://cran.r-project.org/web/packages/geosphere/index.html">package</a>. The lines colour is based on the national teams jersey, which I obtained via R using the amazing <code>extract_colours</code> function in the <code>rPlotter</code> <a target="_blank" href="https://github.com/woobe/rPlotter">package</a>.<img alt="plot_base" class="wp-image-1723" src="https://gjabel.files.wordpress.com/2016/06/plot_base3.png?w=840">I was not entirely convinced that this plot is too effective as the base camp of each team in France is not particularly common knowledge. This led me to create a new plot with a link from the players club teams to their nations capital city.</p>
<p><img alt="plot_cap" class="wp-image-1724" src="https://gjabel.files.wordpress.com/2016/06/plot_cap1.png?w=840">This shows some clear relationships, such as between the Iceland players and clubs in Scandinavia and clubs in northern England and Scotland with the Irish teams. Finally, I had a go at trying to match my old World Cup <a target="_blank" href="https://gjabel.wordpress.com/2014/06/05/world-cup-players-representation-by-league-system/">circular plot</a> using the <code>chordDiagram</code> function in the <code>circlize</code> <a target="_blank" href="http://cran.r-project.org/web/packages/circlize/index.html">package</a>.</p>
<p><img alt="plot_circle" class="wp-image-1725" src="https://gjabel.files.wordpress.com/2016/06/plot_circle2.png?w=840"></p>
<p>I ordered the countries according to their <a target="_blank" href="https://en.wikipedia.org/wiki/UEFA_coefficient#Current_ranking">UEFA coefficient</a>, which is based on the performance of club teams in European competitions. Most players playing abroad are based in teams in the top leagues of England, Germany, Italy or Spain. Players based in the English leagues make up most of the squads for teams from the British Isles. There are sizable numbers of the Austrian and Swiss squads playing for clubs in the German leagues and Croatian players in Italy.</p>
<p>All the code for the scraping the data and producing the plots are on my <a target="_blank" href="https://github.com/gjabel/ecmig">Github</a>.</p>
<p> </p>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gjabel.wordpress.com/1622/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/gjabel.wordpress.com/1622/" border="0"></a> <img height="1" alt="" width="1" src="https://pixel.wp.com/b.gif?host=gjabel.wordpress.com&blog=13658317&%23038;post=1622&%23038;subd=gjabel&%23038;ref=&%23038;feed=1" border="0"></p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/euro-2016-squads/"></div></div><div><a data-url="http://www.r-bloggers.com/euro-2016-squads/" data-counturl="http://www.r-bloggers.com/euro-2016-squads/" data-count="vertical" data-text="Euro 2016 Squads" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://gjabel.wordpress.com/2016/06/15/euro-2016-squads/"> R – Guy Abel</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/JHKDM88EefU"></a></div>