Saturday, 9 May 2015

Deep Diving into R


     R Installation


The latest version of R can be downloaded from http://cran.r-project.org/bin/windows/base/
You will be asked whether you want to save or run a file “R-3.2.0-win.exe”. Choose “Save” and save the file on the Desktop. Then double-click on the icon for the file to run it and install R.

RStudio

RStudio is the Integrated Development Environment for R. It comes in two varieties namely:
a) RStudio Desktop: RStudio Desktop is a standalone desktop application. It can be downloaded from the following link: http://www.rstudio.com/products/rstudio/download/.
b) RStudio Server: It is a Linux server application that provides a web browser based interface to the version of R running on the server. It is necessary for:

    • Computations that require larger CPU utilization
    • Efficient utilization of resources
    • Usage of standardized R package versions

Installing R packages

Choose Install Packages from the Packages menu in Rstudio.
Select a CRAN mirror.
Choose the package.
Use library (package) function to load it for use. 

Getting Help

R has built in help system. The following commands can be used to access it:
help.start()                          # for general help
help(mean)                         # help about the function mean
?mean
apropos("str")                     # lists all functions containing the string “str”
example(mean)                   # shows an example of mean ()
vignette(“mean”)                  #Show vignette for mean

Key Objects

R mainly supports two types of objects:

Basic Objects

Important basic objects are:
  • Atomic Vector: All the elements of an atomic vector should be of the same type. Based on the type of values it contains atomic vector can be differentiated into three types namely numeric vector, logical vector and character vector.
  • List: Lists can have atomic vectors or other lists as components.

Derived Objects

Following are the derived objects in R:
  • Matrix: All elements of the matrix should be of the same type.
  • Data frame: It can have different data types in different columns.
  • Factors: Factors contain categorical data. 

Data Import and Export

R can read different types of files e.g. plain text files, databases, Excel files, XML, HTML files, SPSS, SAS and Stata formatted data. The data in R can be exported in all these formats.

Developing Web applications in R

Shiny is a powerful framework used for building interactive web applications using R. A Shiny application is defined by two files namely ui.R and server.R. The file ui.R contains the definition of the application interface and server.R contains the code for the computation. 

Tuesday, 5 May 2015

R Programming

Facts about letter R

R is the 18th letter of the English alphabet. The letter R is the eighth most common letter in English and the fourth-most common consonant.

Developer’s R

R is a free software and programming language developed by Ross Ihaka and Robert Gentleman. R can be considered as the implementation of the S language which was developed in the 1980s. R can be regarded as an integrated environment that facilitates data manipulation, calculations and graphical display of the data. It is mainly used for statistical computations. The source code of R is maintained now by the RDevelopment Core Team. The functionality of R can be extended by adding R packages. The latest version of R is version 3.2.0 which was released on April 16, 2015. It is also used by some technology majors like Google and Facebook.
R is a powerful statistical programming language. It is derived from the S language which was developed by Bell Labs. R can work in all major Operating Systems including Windows, Linux and MacOS. The code and data in R can be distributed as packages. It supports both object oriented and functional programming methodologies. R programs require less debugging time because the lines of code are less. R is an interpreted language. All the computations are carried out in the main memory and hence R has limitations in dealing with large datasets. This can be easily tackled by using the database interfaces available with R.

Features of R

  • Open Source software: R is freely available under the GNU GPL. The source code of R is primarily written in C and FORTRAN.
  • Designed for data analysis: It consists of a vast collection of algorithms for data retrieval, processing and analysis. Dimensionality Reduction, Frequent Pattern Mining, Sequence Mining, Clustering and Classification are some of the algorithms implemented in R.
  • Variety and quality of graphics: R offers a variety of graphical functions such as bar plots, pie charts, histograms, time series, dot charts, image plots, 3D surfaces, scatter plots, maps etc.
  • Object Oriented: R consist of three types of object oriented features i.e. S3, S4 and R5.
  • Community Support: Vast community support of more than 2 million users.
  • Platform independence: R is available for all platforms.


Wait for more updates about R in the next post.....
Have a Happy Day!