Monday, May 12, 2014

Data analysis using R - R programming Tutorial ( Part 1 )

Getting Started with R

What is R?
R is a high-level computer language and environment for statistics and
graphics
I Performs a variety of simple and advanced statistical methods
I Produces high quality graphics
I R is a computer language so we can write new functions that extends


R’s uses
R was initially written by Ross Ihaka and Robert Gentleman at the
Department of Statistics of the University of Auckland in Auckland, New
Zealand (hence the name)
R is a free open source software maintained by several contributors.
Including an “R Core Team” of 17 programmers who are responsible for
modifying the R source code
The official R home page is   R



Installing R

The R system can be installed on, Windows, Mac or Linux.
You will want to install the base system. To do so visit the R website and
follow the installation directions.
In addition to the base system there are user contributed add-on packages.
Packages are a collection of functions, examples and documentation that
usually focus on a specific task.
The base system contains some packages. To install an additional package,
say gplots, be connected to the Internet and type
> install.packages("gplots")
You will be asked to select the mirror site nearest to you, after that
everything is automatic.
Before using the contents of the package we need to load it,
> library(gplots)
See the R website for a complete list of contributed packages

R Console

The R Console is where computations are performed
An expression is inputed into the console and the expression is evaluated.
Depending on the expression, the system may respond by outputting results
to the console or creating a graph in a new window. Then another
expression is inputed and evaluated.
An R session is this interaction between you and the system
To get the last expression entered use the up arrow
To get the value of the last evaluated expression type .Last.value
Press Esc to stop evaluating the current expression