tag:blogger.com,1999:blog-24352048742355220342024-02-02T11:19:49.804-08:00R by Emmanuel JjunjuUnknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-2435204874235522034.post-64117645382471256392014-05-29T10:20:00.001-07:002014-05-29T10:28:50.428-07:00Simple analysis of a few aspects of the Wikipedia World cup 2014 squads dataThe data and script for this post can be found on this <a href="https://gist.github.com/ejjunju/1aed5c6656f0bb5c24b4">gist</a> . The data is taken from wikipedia(http://en.wikipedia.org/wiki/2014_FIFA_World_Cup_squads). The script analyses the data to create interesting charts about the 2014 world cup squads. Charts include box plots of age, number of home/foreign based players for each country, clubs with more than 4 players in the world cup and leagues with more than 10 players in the World cup.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPyDDOWSZtw0Oryu3m7ZNURm2kw2_8m-nqcbtGEWTiLYBYUgzvKRBImUEEJiFfO6jEkvVT378I0B0MfLU43RZJ91tOc1n-acXyRYiDE1aPNukmOgXGtCnkP-bzIPkKXbWwpcqtI8P14eQf/s1600/worldcup.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPyDDOWSZtw0Oryu3m7ZNURm2kw2_8m-nqcbtGEWTiLYBYUgzvKRBImUEEJiFfO6jEkvVT378I0B0MfLU43RZJ91tOc1n-acXyRYiDE1aPNukmOgXGtCnkP-bzIPkKXbWwpcqtI8P14eQf/s640/worldcup.png" /></a><br />
<br />
The data shows that the youngest team is the Netherlands(Dutch) team. Only Mexico, Netherlands, Spain, England, Italy, Russia, germane and Iran have more home-based players than foreign based players. Most teams have less players based in their home countries. The European clubs dominate the number of clubs with the most players in the world cup (again not a surprise)!! The world cup 2014 appears to be a sort of "European Cup"!! <br />
<br />
Links to the scripts and input data<br />
<script src="https://gist.github.com/ejjunju/1aed5c6656f0bb5c24b4.js"></script><br />
Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-2435204874235522034.post-48020222296333692892014-02-20T12:54:00.000-08:002014-02-20T13:27:37.955-08:00Control R from Excel<b>Here is a simple script modified from <a href="http://homepage.univie.ac.at/erich.neuwirth/php/rcomwiki/doku.php?id=wiki:how_to_install">univie.ac.at</a> that you can just run in R. Follow the instructions in the ensuing dilaogue boxes after running the script. <br />
<br />
This RExcel interface will help you if you tend to work with people whose knowledge of R is weak but you want them to be able to use R-scripts that you share with them.<br />
<br />
<script src="https://gist.github.com/ejjunju/9122929.js"></script><br />
<br />
And the result: A new toolset complete with R_menus under the Addins Ribbon in Excel.</b><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibyOWOlO3oWeGJZ51ywIfbOUqhMKYZJYIYpAUny3Hd_TjCzQov2uOm_J0x9ki6S1KSF0gwWJDnbyd238bNCc22kh8oyQuN7EOQeleJttvICyG6af3JVtQfw26ul8PEpnL5BxT_3YxaY7Fq/s1600/Capture.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibyOWOlO3oWeGJZ51ywIfbOUqhMKYZJYIYpAUny3Hd_TjCzQov2uOm_J0x9ki6S1KSF0gwWJDnbyd238bNCc22kh8oyQuN7EOQeleJttvICyG6af3JVtQfw26ul8PEpnL5BxT_3YxaY7Fq/s1600/Capture.JPG" /></a></div><br />
<b>More customisations are described on <a href="http://homepage.univie.ac.at/erich.neuwirth/php/rcomwiki/doku.php?id=wiki:how_to_install">univie.ac.at</a>. Other <br />
ways for working with R and Excel can be found here <a href="http://www.r-bloggers.com/a-million-ways-to-connect-r-and-excel/">http://www.r-bloggers.com/a-million-ways-to-connect-r-and-excel/</a></b>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2435204874235522034.post-56992952538456679982014-02-14T05:20:00.000-08:002014-02-14T05:21:30.708-08:00Curve testing and fitting in RI have found this <a href="http://stackoverflow.com/questions/14190883/fitting-a-curve-to-specific-data">post</a> to be very useful;Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2435204874235522034.post-89350849348039113462014-02-13T01:04:00.000-08:002014-02-13T01:04:56.863-08:00Install and load missing specified/needed packages on the fly<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><span style="line-height: 16.799999237060547px; text-align: justify;">This is a short script to help installing packages on the fly.</span><span style="line-height: 16.799999237060547px; text-align: justify;">It is most useful if you are distributing a set of script files to people who may not </span><span style="line-height: 16.799999237060547px; text-align: justify;">be aware that the needed packages are not installed on their systems. </span><span style="line-height: 16.799999237060547px; text-align: justify;">It is also useful if you use many </span><span style="line-height: 16.799999237060547px; text-align: justify;">packages and want to organise their installation </span><span style="line-height: 16.799999237060547px; text-align: justify;">(if missing) and/or loading at the beginning of </span><span style="line-height: 16.799999237060547px; text-align: justify;">a script.</span><br />
Enjoy:<script src="https://gist.github.com/ejjunju/8971783.js"></script></span><br />
<pre class="line-pre" style="padding: 0px; width: 931px;"><span style="font-family: Arial, Helvetica, sans-serif;"><div style="line-height: 16.799999237060547px; text-align: justify;"></div></span></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2435204874235522034.post-26587487853747282312014-02-12T08:55:00.000-08:002014-02-13T01:06:21.194-08:00Digitizing jpeg graphs in R<h2><span style="background-color: white;"><span style="color: blue; font-size: x-large;"> </span></span></h2><span style="font-family: Georgia, Times New Roman, serif;">I have been using third party programs for a long time until i came across the documentation for the R-package digitize. unfortunately, this package is not available for R 3.0.2 so i had to tweek things around. I am glad to share my solution.</span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><br />
</span> <span style="font-family: Georgia, Times New Roman, serif;">I started by taking a look at http://lukemiller.org/index.php/2011/06/digitizing-data-from-old-plots-using-digitize/. Luke Miller has written a very nice description of how to use the digitize package. Some of the text here presented is from Luke Miller.</span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><br />
</span> <span style="font-family: Georgia, Times New Roman, serif;">The digitize package <span style="background-color: white; line-height: 20.479999542236328px;">by Timothée Poisot actually relies mainly only the functions readImg, ReadAnadCal, Digitdata and Calibrate. ReadImg requires readJPEG from the jpeg package. </span>Once the jpeg package is installed and loaded, then just load these functions craeted by <span style="background-color: white; line-height: 20.479999542236328px;">Timothée Poisot. The functions can be downloaded from </span><span style="line-height: 20.479999542236328px;"><a href="https://github.com/tpoisot/digitize/blob/master/digitize/R/functions.r">https://github.com/tpoisot/digitize/blob/master/digitize/R/functions.r</a></span></span><br />
<span style="font-family: Georgia, Times New Roman, serif;"><br />
</span> <span style="font-family: Georgia, Times New Roman, serif;">The code snippet below shows my implementation. I have added the use of the tcltk2 package so that one can browse and select the the jpeg file directly.</span><br />
<script src="https://gist.github.com/ejjunju/8959259.js"></script> <span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><br />
</span> <span style="font-family: inherit;"><br />
</span> <span style="font-family: tahoma, arial, verdana, san-serif; font-size: x-small;"><span style="line-height: 20.479999542236328px;"><br />
</span></span> <span style="font-family: tahoma, arial, verdana, san-serif; font-size: x-small;"><span style="line-height: 20.479999542236328px;"><br />
</span></span>Unknownnoreply@blogger.com0