About R

R is an integrated suite of software facilities for data manipulation, calculation and graphical display. R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering) and graphical techniques, and is highly extensible. 

One of R’s strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control. Among other things, R has:
  1. An effective data handling and storage facility.
  2. A suite of operators for calculations on arrays, in particular matrices.
  3. A large, coherent, integrated collection of intermediate tools for data analysis.
  4. Graphical facilities for data analysis and display either directly at the computer or on hardcopy.
  5. A well developed, simple and effective programming language (called ‘S’) which includes conditionals, loops, user defined recursive functions and input and output facilities.

Accessing and using R

R is accessed via the Virtual Laboratory (vLab). For instructions on how to access the vLab, head to the vLab page here.

Launch R via the vLab

First-time users

Consider watching this Introduction to Data Science with R (1:22')

Technically R is an expression language with a very simple syntax (it is case sensitive).  Elementary commands consist of either expressions or assignments. Usually, you will do your programming by writing your programs in script files and then you execute those scripts at your command prompt with the help of R interpreter called Rscript.

The R program’s structure is similar to the programs written in other computer languages such as C or its successors C++ and Java. However, important differences between these languages and R are (i) R has no header files, (ii) most of the declarations are implicit, (iii) there are no pointers in R, and (iv) text and strings as vectors can be defined and manipulated directly. R is a functional language. Most of the computation in R is handled using functions. The R language environment is designed to facilitate the development of new scientific computation tools.

Everything (such as functions and data structure) in R is an object. To see the names of all objects in R workspace, on R command prompt just type 'ls()'. The function 'objects()' is an alternative to 'ls()' function. Similarly, typing the name of any object on R prompt displays (prints) the content of that object. As an example type q, mean, and lm etc. on R prompt.

It is possible to save individual object or collection of objects into a named image file. The named image file has extension of .RData. 

To save content of R workspace into a file .RData, type '> save.image()'

To save objects in file archive.RData, type 'save.image(file = “archive.RData”)'

To save some required objects in data.RData, type 'save(x, y, file = “data.RData”)'

These image files can be attached to make objects available in the next R session.  

Note that when quitting, R offers the option of saving workspace image. By default workspace is saved in an image file (.RData) in the working directory. The image file can be used in the next R session. Saving the workspace image will save everything from current workspace. Therefore, use rm() function to remove objects that are not further required in next R session.


Frequently Asked Questions (FAQs)

Can't find what you need?

Contact the vLab Manager