Statistical Computing: Installing R and RStudio

Posted by Ashwin Jain
Ashwin Jain

“Statistical computing is the interface between

statistics and computer science.”

 

Maths against smiling friends students talking together

What is Statistical Computing?

Computational statistics are statistics done with a computer. Everything from ML to the graphical model to the inverse eigenvalue problem is involved in statistical computing. Data analysis and statistical modeling techniques can be challenging, and computer software is the best way to analyze large data sets and get relevant results. Statistical computing languages are vast, but we will focus on R, the known standard, and one of the most influential and flexible statistical software packages with graphical displays.

 

What is R?

If you have not heard of R, it is a language. It’s an open-source project and is maintained by The Comprehensive R Archive Network (CRAN). R is based on S language developed @ Bell Labs by statisticians. It’s free software licensed under Free Software Foundation’s GNU General Public.

 

R! what it is good for?

R provides fast visualization and quick analysis prototyping. It runs quickly, is intuitive, and it is interactive. It supports Windows, Linux, and macOS X platforms and provides excellent data manipulation, calculation, built-in analysis, and high-quality graphical display, which helps model the data behavior. R is a functional language supporting OOP, including different data types, conditionals, loops, in-built functions, user-defined functions, input, and output facilities.

Libraries called packages:

  • Basic Packages like base, datasets, graphics, grid, methods, stats, tools
  • Add-on packages from different libraries like SiLK, ggplot2, etc
  • Packages are found on R Cran, Bioconductor, or GitHub
  • Shiny: package that helps you build interactive web apps and dashboards - with CSS themes, Javascript libraries, HTML widgets

It can also be easily combined with tools such as Tableau, Qlik, RapidMiner, Splunk, Teradata, etc.

 

Who uses R?

Government

Telecoms

Insurance

  • R to determine catastrophic risk and thus influence the cost

Finance

  • CRAN has packages for Finance related empirical works

Pharma

  • FDA scientists developed R packages to determine usage in the drug submission process. http://blog.revolutionanalytics.com/2013/08/r-drug-development-and-the-fda.html

Network Analysis

  • There are several R packages for cybersecurity research, risk analysis, metadata collection, logs/data processing, DFIR, and much more.

 

Install R: Step by step instructions.

For Windows Users

  1. Open the browser and type the URL: www.r-project.org (Alternatively, you can search on Google for R project)
    Screen Shot 2020-10-01 at 3.04.07 PM
  2. Click on the "download R" link.
    Screen Shot 2020-10-01 at 3.04.41 PM
  3. Select a CRAN location (a mirror site: you can choose this according to your location.)

    Screen Shot 2020-10-01 at 3.04.47 PM
  4. Click on the "Download R for Windows" link at the top of the page.
    Screen Shot 2020-10-01 at 3.04.53 PM
  5. Click on the link "install R for the first time" link.
    Screen Shot 2020-10-01 at 3.04.57 PM
  6. Click on "Download R for Windows" and save the .exe file on your computer.  Run the .exe file and follow the installation instructions.  
    Screen Shot 2020-10-01 at 3.05.09 PM
  7. Once downloaded, open the .exe and install R, follow the screen instructions to complete the installations. Create a desktop shortcut for easy access. Open the R console based on the bit-ness of your computer.
    Screen Shot 2020-10-01 at 3.05.29 PM

For MAC Users:

**(for images @ Step 1-4: refer to R Installation Steps for Windows.)

  1. Open the browser and type the URL: www.r-project.org (Alternatively, you can search on Google for R project)
  2. Click on the "download R" link.
  3. Select a CRAN location (a mirror site: you can choose this according to your location.)
  4. Click on the "Download R for (Mac) OS X" link at the top of the page.
  5. Click on the .pkg file under the latest version.
    Screen Shot 2020-10-01 at 3.09.30 PM
  6. Save the .pkg file, double-click it to open, and follow the installation instructions, create the desktop shortcut for easy access to R console.

 

For Linux Users:

**(for images @ Step 1-4: refer to R Installation Steps for Windows.)

  1. Open the browser and type the URL: www.r-project.org (Alternatively, you can search on Google for R project)
  2. Click on the "download R" link.

  3. Select a CRAN location (a mirror site: you can choose this according to your location.)

  4. Click on the "Download R for Linux" link at the top of the page.

  5. Click on the Linux OS click on the link.
    Screen Shot 2020-10-01 at 3.14.54 PM
  6. Each OS has different installation steps; if these don’t work, try the instructions to install R on a Linux machine.

 

R Studio:

  • RStudio is IDE for R. So, R is the pre-requisite for R.
  • It provides several advantages over R console as an IDE, including syntax highlighting, code completion, and indentation.
  • It efficiently manages R projects, R help, and documentation.
  • It provides a debugger for R and eases the package development.
  • RStudio Server can be run on a remote server providing R in cloud functionality.

 

Install R Studio: Step by step guide

  1. Open www.rstudio.com and click on the "Download" link.
    Screen Shot 2020-10-01 at 3.21.20 PM
  2. Click on the "Download RStudio Desktop" version.
    Screen Shot 2020-10-01 at 3.21.23 PM
  3. Click on the latest Windows version and save .exe file.
    Screen Shot 2020-10-01 at 3.21.29 PM
  4. Execute the .exe file and follow the screen instructions for installation. Click Finish. Open the RStudio by searching in the windows search bar.
    Screen Shot 2020-10-01 at 3.22.53 PM

For Mac Users

**(for images @ Step 1-4: refer to RStudio Installation Steps for Windows.)

  1. Open www.rstudio.com and click on the "Download" link.
  2. Click on the "Download RStudio Desktop."

  3. Click on the latest Mac version and save .dmg file.
    Screen Shot 2020-10-01 at 3.26.20 PM
  4. Execute the .exe file and follow the screen instructions for installation. Click Finish. Open the RStudio by searching in the windows search bar.
    Screen Shot 2020-10-01 at 3.26.26 PM

 

 

For Linux Users

**(for images @ Step 1-4: refer to RStudio Installation Steps for Windows.)

  1. Open www.rstudio.com and click on the "Download" link.
  2. Click on the "Download RStudio Desktop."

  3. Click on the version based on your Linux distribution and save the individual file.
    Screen Shot 2020-10-01 at 3.28.55 PM
  4. Open the file in the default software center and install; otherwise, install via the command line.

 

Conclusion:

In brief, we covered how and why R is an excellent option in statistical computing. We saw different use cases for it across multiple industries and how to install R and IDE for R – Rstudio on different Os.

In Part two, we will go through how R basics and R for CyberSecurity. Stay tuned!

 

Did you enjoy this content? Follow our linkedin page!

 

Looking for similar content?

Ashwin Jain

Written by Ashwin Jain

I am a graduate of IIT Kanpur and have 14 years of software development/consulting experience with wide-ranging technologies. I have also a keen interest in machine learning and worked on multiple AI projects including voice, fingerprints & big data analytics.