Installation Guide for R and R Studio
This tutorial is designed to get you started in R programming language. Before we jump into running codes in R let's look at the motivation of creating R and its unique characteristics.
The origin story of R
S, the language is the predecessor of R, or more precisely R is a vocabulary of S. S was first developed in 1976 by John Chambers and team in the Bell Telephone Laboratories (part of AT&T Corp.). It was implemented as FORTRAN libraries. It was designed for the internal statistical analysis team. It was devoid of statistical modelling capabilities.
The above language was rewritten in C and took its first path towards what we have the language today. However, the S language has gone through a roller coaster after version 4 was released in 1998. At present, TIBCO is the current owner and the only developer. The whole story of changing hands from S to R language licenses was vast and several corporations got involved.
How is this important to Learn R?
S was only available in commercial packaging. However, the philosophy or the motivation behind S is what resonates with R. S, the language was developed for the only purpose of making data analysis easier for the company. In the book, inventor-developer John Chambers, Stages in the Evolution of S, he expressed that the language was written so that users first took advantage of the interactive environment, taking away the programming part. Then gradually these users could start coding sophisticated codes as their ideas and workflow became clearer.
Thus S was designed for the users to be able to do both exploratory/interactive data analysis and write longer scripts like traditional structured programs.
R inherits this motivation thoroughly. R was developed quite later by Ross Ihaka and Robert Gentleman at the University of Auckland in 1991. They worked at their Department of Statistics. The first public release was done in 1993. Their paper enlisting their experience in developing R was published in 1996 in the Journal of Computational and Graphical Statistics.
One of the major changes was brought about by Prof. Dr. Martin Mächler who convinced the two developers to make R free software under GNU General Public license.
In 1997, Two mailing lists, one for help (R-help) and the other for development (R-devel) were created. the first version was released in 2000 for the public. The current version is R version 4.0.5.
Installing R
If you go to the Comprehensive R Archive Network you will find the primary R system available. This site is also known as CRAN. This site shows packages, sources, and binaries for the software. CRAN has mirror sites for respective countries. This site also contains downloadable links for other software packages from neural networks, software connectivity packages, memory management packages and many more. Below is a screenshot of the website.
- Now if you select the Download R for Windows link, it will start downloading (PS: Linux and Mac users will be directed towards their respective pages).
- Run the downloaded file.
- You will directed to a simple install wizard and keep clicking on NEXT.
- Follow the screenshots below:
Installing R Studio
Most people who use R use RStudio as their preferred Integrated Development Environment (IDE). We can use another online development environment like Google Colab and even the browser-based notebook Jupyter but let's learn R using RStudio for now.
To download RStudio :
- Go to the RStudio home page
- R studio comes with several different license types as shown below:
- For your personal use, RStudio Desktop is suitable.
- Even the RStudio Server is free to use.
- Selecting the download you want (RStudio desktop) for the desktop is recommended.
- Run the download .exe file.
- Keep clicking on NEXT. Follow the screenshots shown below.
- Once you have installed both R and RStudio, restart your computer.
- Search for RGui (64Bit/32Bit) application from the start menu.
- It will open a GUI like below:
In the screenshot above :
- We see an R console window with a red (>) sign. (red ink encircled)
- This is prompt
- This is where you write your code.
- The RGui can handle everything R offers as a language and you as a developer want to code.
- You can also write and load RScript in the RGUI environment.
Why do we need RStudio then?
RStudio is an IDE optimized to run R scripts and commands (every R code you write is called commands). R is a dynamic programming language and interprets the code we write as soon as we run it. Let's keep aside these details for now. Let's look at the RStudio interface and run our first R code or a bunch of R code.
We can write our first R code in RStudio after the prompt (>).
let's write two lines of code for this tutorial.
In the code above, one might get confused about ‘ <-’ (greater than sign followed by a hyphen sign) acting as the assignment operator. Further, typing ‘str’ and pressing enter (return) prints the string without using a print statement. These are two of the few unique characteristics of R and it helps immensely in the long run. Although the ‘<-’ feels counter-intuitive for programmers familiar with other programming languages. Then again, the philosophy behind R is not to make users programmers at first.
Disclaimer: The screenshots used in this article are taken by the author on his desktop. It is used for educational purposes.
Also, Thank you for reading so far.💪 Have a small tea or coffee break.😃If you like👍 the blog do like and comment👀 if you need any specific blog post regarding this. Also, feel free to share with your friends, colleagues or who could benefit from this tutorial.