r commander

Using the R Commander – An Alternative GUI

Next to RStudio there is another very helpful R GUI – graphical user interface – called R Commander. In some scenarios, this GUI can really make your job much easier.

Installation

In order to get it on your machine you would at first install the package Rcmdr. Basically the whole GUI can be had by simply getting this add on package. By installing it you would automatically download a whole bunch of dependable packages. Depending on the extra packages you already have on your machine you would probably need to get between 20-40 extra libraries, which are fortunately downloaded automatically – at least most of them. After you are done installing Rcmdr and the array of dependable libraries, R might ask you to install some more packages which have not been collected automatically. You have to manually get the ones missing. The installation process can be easily handled in RStudio in the “packages” window or you can also use install.packages() directly in R.

Starting the GUI

You could run Rcmdr within RStudio but I would advise against it. It would be like running a GUI from within a GUI that already runs in a software. Or simply spoken, running a program within a program that already runs in a program will lead to problems and instability sooner than later. Therefore you would simply load Rcmdr directly in the R Console via library(Rcmdr) and the program opens.

Interface

As you can see the whole thing can be run with mouse clicks to some extent. You can use command line, but the most common features like plots, statistics and simple data management can be done with your mouse. That simply means that you have a stats package like SPSS or STATA that can be run without programming language skills.

Nonetheless you have to keep in mind that the capabilities of Rcmdr are limited when compared to SPSS, STATA or the R language itself. If you are working on more advanced topics, you will have to resort to command line programming.

r commander

When to use the R Commander

There are 3 scenarios I can think of where Rcmdr makes perfect sense compared to command line coding:

  1. You are just starting out with R and programming as a whole. With the click interface of Rcmdr you would also get the code output on your screen. Rcmdr generates the standard R code and sends it to the console so that R does the calculations for you. Each time you see a piece of code and you know what you did in order to get it, you will automatically get a feeling on how R code looks like. Sooner or later you will see patterns which will make coding in RStudio much more intuitive to you.
  2. You want to do standard analysis and plots like boxplots, ANOVAs, t-tests and histograms. Things like that are extremely easy and fast in R Commander. Data import from various sources and programs is very easy and fast as well. Getting standard things done in a quick and dirty approach to get a first impression on your dataset is a strongpoint of R Commander.
  3. You want to automatically generate code on standard procedures which you later on want to manipulate and tailor in R command line. That is a convenient way to get the code base, which is ready to be adapted.

Data import

Basically you have 3 ways in how to get your data into R Comander. Be aware that you need a dataset activated in order to get access to the full functionality of RCmdr.

  1. Importing files from your machine

Of course there is an easy way to import datasets from various other programs. You would simply go to data, import datasets, and you can select the type of data you have. You can change the formatting or the naming of the rows and columns and you can also indicate how to display missing values. You would than simply select the file on your machine and click ok.

  1. Creating a whole new dataset using the editor

To work with the editor simply go to the data tab and select “new dataset”. After naming your dataset you are free to insert the data. It is also fairly easy to insert extra rows and columns with this feature.

  1. Activating a pre-installed exercise dataset

Now one really nice feature of R is the fact that there are so many exercise datasets available which are already on your computer as soon as you download the program. Rcmdr makes use of that. If you go to data, data in packages, you can get a whole list of datasets that are already available. With this feature you can also read exercise data into your Rcmdr instance.

 

R Commander is divided into 3 fields

First there is the script section which is going to show you the generated code. You can see RCmdr as an easy click interface with limited features. The interface will automatically produce the corresponding code in the script section. You can take a look at the code, save it as an Rscript and of course change it if needed. This is basically a great way to get familiar with R code.

You than have the output section which basically does the calculations for you, much like the R console and at last there is a window for messages, in case there are any notes that arise or even error messages.

If you are new to R, and you want an alternative way to learn this language, maybe the R Commander can help you to get good at statistical programming with R. Just give it a try!

2 Comments

  • Sai Chaithanya 22. March 2016 Reply

    Can we integrate this with spark in cloudera cdh 5.5

    • R Tutorials 27. March 2016 Reply

      Rcmdr is just a GUI – to integrate into another software e.g. Spark it is always best to code directly. Rcmdr is basically a tool that generates code for you.

Leave a Reply

Quality R Training for You