In the February ’14 meeting of the Twente R User group, research master student Karel Kroeze gave us a quick run-through of the many possibilities with the ggplot family of functions and building blocks. Although a bit intimidating at first, the R code is immensely flexible once you get the hang of it. Have a go at his code (click here to get the code) from the presentation and see if you can accommodate his code for your own cool graphics! For the accompanying data files, mail Stephanie. Guus provided some extra helpful links, see Tim Churches, CEB institute and cookbook R.
In the January ’14 meeting of the Twente R User group, Janina Torbecke & Inga Schwabe gave an introduction into object oriented programming in R. Although object oriented programming may be more straight forward in other programming languages (e.g. Python, Java, C++), it can be useful in R to enable the use of generic functions (e.g. for your own library), to program efficiently (e.g. elimination of redundant code) or just to produce neat code.
The code that was used to explain the idea of object oriented programming is part of a battleship game made in R. You can find the slides of the presentation here: Object oriented programming in R and the R code here: Battleship game in R.
P.S.: I posted this blog post directly from R, using the simple markdown language and the RWordPress library. To do this, I used the following code:
## Install Rwordpress library if (!require("RWordPress")) install.packages("RWordPress", repos = "http://www.omegahat.org/R", type = "source") ## Load packages & log in on wordpress library(knitr) library(RWordPress) library(XML) # Upload post to blog options(WordPressLogin = c(ingaschwabe = "*****"), WordPressURL = "https://twenterug.wordpress.com/xmlrpc.php") knit2wp("OOP_in_R.Rmd", title = "Object oriented programming in R", publish = TRUE)
For those who are still learning the basics of the R programming language, the following website might be interesting:
Another thing that might be interesting is the recently released R-library Swirl. The swirl R package is designed to simultaneously teach users statistics and the R programming language. In a typical swirl session, the user is required to load a package from the R console and chose from a menu of options the course he would like to take. Then he works through 10-15 minutes interactive modules, each covering a particular topic.
To install it, this is all you have to do in R:
Note however that the package is yet released and constantly fixed and updated. It is therefore recommended to update the version at least one ca month so you have full access to the latest features.
This is the official website of the package: http://swirlstats.com
You can find a blog post on the release of the new package on Simply Statistics:
After a short summer break, the third meeting oft he TRUG took place on October 7th.
Henk Broekhuizen presented how R can be used for Monte Carlo simulations. Henk introduced the problem of combining probability distributions, then introduced the main ideas behind Monte Carlo simulations and finished with some outcomes from his own work in probabilistic MCDA models. In this kind of decision analysis, model outcomes are a complex function of the inputs. When these inputs are probability distributions, calculating the outcomes analytically becomes hard and sometimes impossible. Monte Carlo simulations are a useful and straightforward approach to approximate and visualize these model outcomes. A pdf file of the presentation can be downloaded here: Third_TRUG_meeting
The second meeting of the TRUG took place on July 11th.
Inga Schwabe gave an introduction into the world of resampling methods. Resampling methods can be a good alternative when classical statistical methods that are largely based on idealized assumptions (e.g. normal distribution) cannot be used for statistical inference. This was shown by means of a simple example: The empirical p value was calculated for the difference between the scores of a treatment and a control group by using a resampling method called ‘Permutation’. A pdf file of the presentation can be downloaded here: Second_TRUG_meeting
A sunny sky and a not-too-fresh breeze marked the beginning of the Twente R User Group. While enjoying drinks and tapas in the lush Twente countryside, both students and staff from several departments of the University of Twente met and exchanged experiences and ambitions regarding their use of the statistical programming software R.
The level of experience and type of ambitions varied greatly. Some hardcore programmers want to familiarize themselves with R to broaden their horizon, some use R for Monte Carlo simulation, some merely want to use a platform for data manipulation and analysis that does not require an expensive license, and some use R because it can do types of analyses that can’t be carried out using SPSS. Several members in the group were interested in parallelization and integration with C++ code to speed up analyses.
Martin Schmettow was the first to present. Martin, working at the department of Cognitive Psychology and Ergonomics, presented how to deal with card sorting data, showing some code how to construct graph data from the card sorting data (represented as lists of lists) using a recursive function, and how to best present analysis results: hot-spot plots rather than dendograms. Several libraries and their functions were discussed, like for instance plyr. Powerpoint slides can be found here: Cardsorting Workflow.
The User Group will meet monthly, alternating days and times so that more people are able to join, even if they can only attend bi-monthly. Next presenter, July 11, will be Inga Schwabe, from the Department of Research Methodology, Measurement and Data Analysis. July 11, 1700 hrs, Weleweg 410, Boekelo.