Rlogo MROlogo RStudio

The R environment

R is an integrated suite of software facilities for data manipulation, calculation and graphical display. Among other things it has * an effective data handling and storage facility, * a suite of operators for calculations on arrays, in particular matrices, * a large, coherent, integrated collection of intermediate tools for data analysis, * graphical facilities for data analysis and display either directly at the computer or on hardcopy, and * a well developed, simple and effective programming language (called ‘S’) which includes conditionals, loops, user defined recursive functions and input and output facilities. (Indeed most of the system supplied functions are themselves written in the S language.)

The term “environment” is intended to characterize it as a fully planned and coherent system, rather than an incremental accretion of very specific and inflexible tools, as is frequently the case with other data analysis software. R is very much a vehicle for newly developing methods of interactive data analysis. It has developed rapidly, and has been extended by a large collection of packages. However, most programs written in R are essentially ephemeral, written for a single piece of data analysis. (Source: An Introduction to R - R Help)

  1. The Comprehensive R Archive Network: https://cran.r-project.org/ and
  2. Microsoft R Open (MRO): The Enhanced R Distribution is here https://mran.microsoft.com/open/.

Microsoft R Open, formerly known as Revolution R Open (RRO), is the enhanced distribution of R from Microsoft Corporation. It is a complete open source platform for statistical analysis and data science.

The current version, Microsoft R Open 3.3.*, is based on (and 100% compatible with) R-3.3.1, the most widely used statistics software in the world, and is therefore fully compatibility with all packages, scripts and applications that work with that version of R. It includes additional capabilities for improved performance, reproducibility, as well as support for Windows and Linux-based platforms.

Like R, Microsoft R Open is open source and free to download, use, and share.

System Requirements

Some of the basic system requirements for R are described here https://cran.r-project.org/bin/windows/base/rw-FAQ.html#Can-I-use-R-on-64_002dbit-Windows_003f

Before you begin installing Microsoft R Open, make sure the machine on which you will install meets the minimum hardware and software requirements defined on the link https://mran.microsoft.com/archives/install-doc/mro-3.2.5/#sysreq

System Requirements for RStudio, read here https://support.rstudio.com/hc/en-us/articles/201853926-RStudio-IDE-System-Recommendations.

Download and Install R

Precompiled binary distributions of the base system and contributed packages, Windows and Mac users most likely want one of these versions of R:

Download R for (Mac) OS X

Download latest version or R from https://cran.r-project.org/bin/macosx/

This directory contains binaries for a base distribution and packages to run on Mac OS X (release 10.6 and above). Mac OS 8.6 to 9.2 (and Mac OS X 10.1) are no longer supported but you can find the last supported release of R for these systems (which is R 1.7.1) here. Releases for old Mac OS X systems (through Mac OS X 10.5) and PowerPC Macs can be found in the old directory.

Frequently Asked Questions on R for Mac OS X is here https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html

Download R for Windows

Download latest version or R from https://cran.r-project.org/bin/windows/

For installation of latest version of R help and instruction click here https://cran.r-project.org/bin/windows/base/README.R-3.3.1

R is part of many Linux distributions, you should check with your Linux package management system in addition to the link above.

Note: You may download the latest versions of Microsoft R Open from https://mran.microsoft.com/download/.

R Installation and Administration

  1. For complete guide for R Installation and Administration, read these instructions here https://cran.r-project.org/doc/manuals/r-release/R-admin.html
  2. For MRO installation guide click here https://mran.microsoft.com/documents/rro/installation/

Starting R

Start R Gui

Open any of the RGuis installed on your system like below from your computer


This is a typical R Console. type >1 + 2 then press Enter to check that your installation is working fine.


Start R in Commandline (Rterm)

On your Windows system search “rterm” or open R from “C:Files-3.3.1”.

The R terminal would look like this

In Mac OS or Linux based system you may just type “r” or “R” in your xterm or terminal based on profile configurations you may have.


R Help and Manuals

  1. Getting Help with R: https://support.rstudio.com/hc/en-us/articles/200717153-Getting-Help-with-R
  2. R Windows FAQ: https://cran.r-project.org/bin/windows/base/rw-FAQ.html
  3. R on StackOverflow: https://stackoverflow.com/questions/tagged/r
  4. The R Manuals: https://cran.r-project.org/manuals.html
  5. Online Learning: https://www.rstudio.com/online-learning/
  6. MRO (MRAN) Forum: https://social.msdn.microsoft.com/Forums/en-US/home?forum=ropen
  7. Getting started with R: https://mran.microsoft.com/documents/getting-started/

On Rterm console type help(“cat”) or ?cat to get help document for the command cat().


Get Your R IDE (RStudio)

RStudio is an integrated development environment (IDE) for R. It includes a console, syntax-highlighting editor that supports direct code execution, as well as tools for plotting, history, debugging and workspace management. Click here https://www.rstudio.com/products/rstudio/features/ to see more RStudio features.

You can download RStudio from this link https://www.rstudio.com/products/rstudio/. Do not forget to install R or MRO before installing RStudio.

You may access support page for RStudio here https://support.rstudio.com/hc/en-us.

Sample R Commands

Structure of data “airquality”

str(airquality)
## 'data.frame':    153 obs. of  6 variables:
##  $ Ozone  : int  41 36 12 18 NA 28 23 19 8 NA ...
##  $ Solar.R: int  190 118 149 313 NA NA 299 99 19 194 ...
##  $ Wind   : num  7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 ...
##  $ Temp   : int  67 72 74 62 56 66 65 59 61 69 ...
##  $ Month  : int  5 5 5 5 5 5 5 5 5 5 ...
##  $ Day    : int  1 2 3 4 5 6 7 8 9 10 ...

Summary of data “cars”:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Plots of data “pressure”

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.