Sunday, June 10, 2012

Face to Face with R

Before going ahead with further discussions about anything, isn't it good to know how that would look. You bet it is.

Here's how the RGui command line editor looks -

RGui

If you think its dull, well, looks could be deceiving. Just for a change, that white background can be changed to any other color, or that font color, size, etc. as well.

If this is too simple looking, there are other non command line interfaces too. The R Commander and Rattle are to name a few. These are available as packages. It they are not there by default, they can be installed by fetching from CRAN mirror sites or other repositories in some very simple steps.

To check if R Commander is already installed or not, type in the command line editor
library()
A window with the installed packages will show up within RGui. Search for Rcmdr or R Commander in this library list. If it is not there, then follow these steps
R package selection windowinstall.packages()
A window listed with all the available packages will open. Refer snapshot.

Search for Rcmdr in this list and click ok...and relax.

Rest all will be taken care of by RGui itself. If there are dependencies on other packages, it would automatically download those other few packages as well. Once downloaded, RGui will show this message
package ‘Rcmdr’ successfully unpacked and MD5 sums checked.

It will also show the same for all other dependency packages and return back to the R prompt. Now R is ready to launch the R Commander. Type
library(Rcmdr)
Wasn't that easy? But there is another approach too!
More than one way  

Load Packages menu in RGui
Load Packages
Go to the RGui menu and click on Packages, click on Load Package. If the package is already installed, select the name (Rcmdr) and click ok.
 
If the package is not installed, go to RGui menu and click on Packages, click on Install Package(s)... A window with all available packages will show up. Select Rcmdr from the list, click ok and sit back. No typing, just click click click.
 
Ok, it's installed. What next? Don't we at least want to see how it looks? Sure! In the RGui command line editor, type -
library(Rcmdr)
and bingo! The R Commander shows itself.


Hey! Wasn't there something called the "Rattle"? Ahh! Installing is not much different. Instead of Rcmdr, use the term....what else..."rattle" of course. Remember, it has to be in small case.

There are two commands to type to load rattle
library(rattle)
This will show the below message -
Rattle: A free graphical interface for data mining with R.
Version 2.6.18 Copyright (c) 2006-2011 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
 
Now, if you sure that you want to shake, rattle and roll your data, type
rattle()
And there you will have rattle, the R Data Miner screen up on your screen.

R Data Miner screen

That's all for showing the faces of R and getting to interact with the R statistical tool. How to use them? Keep watching this space.

Thursday, May 24, 2012

Hello R


Data, Data, Data!

Drenched with heaps and heaps of data, some smart folks thought of making use of them. And how do they use? In the process of trying to understand and use the data, there were these other smart guys who fried their brains out to help get meaning out of such data.
As the process of finding meaning of data evolved, these nerds playing with heaps and heaps of data gave it a fancy name "Statistical Analysis".

And then there were these smart dudes Ross Ihaka and Robert Gentleman who created a programming language called R.

"R"?

Why is it called so? Perhaps they were too busy to use it than worry about finding the perrrrrfect name and hence got left ambiguous. They had a play on words. Both the dude's names initials was R. It was an implementation of an already existing statistical programming language called "S" and influenced by Scheme, another functional programming language.

So the question that follows immediately is "What it?"
It is a programming language for statisticians
It is a programming language for analysts
It is written majorly in R itself. Wait! What? Yeah, and some parts in C and Fortran
It can be extended for newer computations by adding packages
It is open source. Oh! so is it free? Yes ....and it is the best awesome "do anything" calculator software

There are various geeks in the academic class such as colleges and universities who use R extensively. It has a drawback of having a very simple interface....aargh! the boring command line again! And yet, it has been gaining popularity to such a level that it is giving good competition to other commercial software packages like SPSS, SAS, etc. I don't know anything about SAS, is it even an abbreviation? I am not interested for now. I have met SPSS briefly in a kind of introduction which goes like "Hey meet SPSS, she is cool". But she is also way off my purview now.

At present, it's R and I have full access to her! But for now, this is just to begin with. Next, we will get to know R more personally.

Note: Thanks to Ajay Ohri for some corrections here.